[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#832873: ghostscript: FTBFS: sjpx_openjpeg.c:605: undefined reference to `opj_image_destroy'



Control: tags -1 +patch

Le vendredi, 29 juillet 2016, 08.48:47 h CEST Lucas Nussbaum a écrit :
> During a rebuild of all packages in sid, your package failed to build on
> amd64.
> 
> Relevant part (hopefully):
> > ./base/sjpx_openjpeg.c:249: undefined
> > reference to `opj_decode' /usr/bin/ld: ./sobin/libgs.so.9.19: hidden
> > symbol `opj_setup_decoder' isn't defined /usr/bin/ld: final link failed:

I've now spent quite some time investigating this and finally found the
problem: libopenjp2-7-dev (>= 2.1.1) has changed it's
	/usr/include/openjpeg-2.1/openjpeg.h
to include the following lines:

#if defined(OPJ_STATIC) || !defined(_WIN32)
/* http://gcc.gnu.org/wiki/Visibility */
#       if __GNUC__ >= 4
#               if defined(OPJ_STATIC) /* static library uses "hidden" */
#                       define OPJ_API    __attribute__ ((visibility ("hidden")))
#               else
#                       define OPJ_API    __attribute__ ((visibility ("default")))
#               endif

This makes all API symbols hidden if '-DOPJ_STATIC' is passed to GCC; as
it happens to be passed in base/lib.mak :

$(GLOBJ)sjpx_openjpeg.$(OBJ) : $(GLSRC)sjpx_openjpeg.c $(AK) \
 $(memory__h) $(gserror_h) $(gserrors_h) \
 $(gdebug_h) $(strimpl_h) $(sjpx_openjpeg_h) $(LIB_MAK) $(MAKEDIRS)
       $(GLJPXOPJCC) $(GLO_)sjpx_openjpeg.$(OBJ) \
               $(C_) -DOPJ_STATIC $(GLSRC)sjpx_openjpeg.c

Patching this -DOPJ_STATIC out fixes the FTBFS; patch attached.

Cheers,
-- 
OdyX
Descrtiption: Don't pass -DOPJ_STATIC when compiling the OpenJPEG code, as it
 makes the symbols hidden when including /usr/include/openjpeg-2.1/openjpeg.h
 .
 Fixes a FTBFS against libopenjp2-7 (>= 2.1.1)
Author: Didier Raboud <odyx@debian.org>
Origin: vendor
Bug-Debian: https://bugs.debian.org/832873

--- a/base/lib.mak
+++ b/base/lib.mak
@@ -1830,11 +1830,11 @@
 
 $(GLOBJ)sjpx_openjpeg.$(OBJ) : $(GLSRC)sjpx_openjpeg.c $(AK) \
  $(memory__h) $(gserror_h) $(gserrors_h) \
  $(gdebug_h) $(strimpl_h) $(sjpx_openjpeg_h) $(LIB_MAK) $(MAKEDIRS)
 	$(GLJPXOPJCC) $(GLO_)sjpx_openjpeg.$(OBJ) \
-		$(C_) -DOPJ_STATIC $(GLSRC)sjpx_openjpeg.c
+		$(C_) $(GLSRC)sjpx_openjpeg.c
 
 # ---------------- Pixel-difference filters ---------------- #
 # The Predictor facility of the LZW and Flate filters uses these.
 
 pdiff_=$(GLOBJ)spdiff.$(OBJ)

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: