Question

I am trying to build 'lcms2' static library which is dependent on libtiff. libtiff has again dependency on libjbig. I have successfully configured libtest with the following parameters:

CFLAGS="-fPIC" CXXFLAGS="-fPIC" LIBS="-ljbig" ./configure --prefix=/usr/local --enable-static=yes --enable-shared=no --with-zlib=yes --with-jpeg=yes --with-tiff=yes --with-pic=PIC

The configure reports no error:

checking for TIFF support ... 
checking tiff.h usability... yes
checking tiff.h presence... yes
checking for tiff.h... yes
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking for TIFFOpen in -ltiff... yes
checking for TIFFClientOpen in -ltiff... yes
checking for TIFFIsByteSwapped in -ltiff... yes
checking if TIFF package is complete... yes
checking tiffconf.h usability... yes
checking tiffconf.h presence... yes
checking for tiffconf.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lcms2.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating utils/tificc/Makefile
config.status: creating utils/transicc/Makefile
config.status: creating utils/linkicc/Makefile
config.status: creating utils/jpgicc/Makefile
config.status: creating utils/psicc/Makefile
config.status: creating testbed/Makefile
config.status: executing depfiles commands
config.status: executing libtool commands

The when I make the library it throws the following error:

/bin/sh ../../libtool --tag=CC   --mode=link gcc -std=gnu99  -fPIC   -o tificc tificc.o xgetopt.o vprf.o ../../src/liblcms2.la -ltiff -ljpeg -lz -lm 
libtool: link: gcc -std=gnu99 -fPIC -o tificc tificc.o xgetopt.o vprf.o  ../../src/.libs/liblcms2.a -ltiff -ljpeg -lz -lm
/usr/local/lib/libtiff.a(tif_jbig.o): In function `JBIGDecode':
tif_jbig.c:(.text+0xc4): undefined reference to `jbg_dec_init'
tif_jbig.c:(.text+0xe4): undefined reference to `jbg_newlen'
tif_jbig.c:(.text+0x116): undefined reference to `jbg_dec_in'
tif_jbig.c:(.text+0x12a): undefined reference to `jbg_strerror'
tif_jbig.c:(.text+0x177): undefined reference to `jbg_dec_getimage'
tif_jbig.c:(.text+0x188): undefined reference to `jbg_dec_getsize'
tif_jbig.c:(.text+0x1ac): undefined reference to `jbg_dec_free'
/usr/local/lib/libtiff.a(tif_jbig.o): In function `JBIGEncode':
tif_jbig.c:(.text+0x402): undefined reference to `jbg_enc_init'
tif_jbig.c:(.text+0x40d): undefined reference to `jbg_enc_out'
tif_jbig.c:(.text+0x418): undefined reference to `jbg_enc_free'
collect2: ld returned 1 exit status
make[1]: *** [tificc] Error 1
Was it helpful?

Solution

libtool: link: gcc -std=gnu99 -fPIC -o tificc tificc.o xgetopt.o vprf.o ../../src/.libs/liblcms2.a -ltiff -ljpeg -lz -lm

There is no reference to JBIG library in the linking command (I don't remember if it should go before or after - some libraries require both - the reference to libtiff, -ltiff), so jbg_* references can't be resolved. Having LCMS linked does not help you, since JBIG is not linked in, but only referred to, by JBIG.

Add -ljbig to the link command.

Or, manually edit the Makefile and add -ljbig to LIBS (eg. LIBS = -ljbig).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top