Configure bug? Building with libtiff on macOSX 10.12

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
DaveBurns
Posts: 4
Joined: 2016-12-07T22:59:43-07:00
Authentication code: 1151

Configure bug? Building with libtiff on macOSX 10.12

Post by DaveBurns »

I don't know autoconf so I don't know if this is a bug in the script or something I'm doing wrong. Please let me know.

When I configure ImageMagick on macOS, it fails to find libtiff:

Code: Select all

checking for TIFF... 
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... no
checking for TIFFClientOpen in -ltiff... no
checking for TIFFIsByteSwapped in -ltiff... no
checking for TIFFReadRGBATile in -ltiff... no
checking for TIFFReadRGBAStrip in -ltiff... no
checking if TIFF package is complete... no -- some components failed test
When I look at config.log, I see the build of conftest.c for the failed tests and the issue is not the missing TIFF* calls, it's that the linker can't find zlib. One example:

Code: Select all

Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      _PixarLogPostEncode in libtiff.a(tif_pixarlog.o)
      _PixarLogEncode in libtiff.a(tif_pixarlog.o)
      _ZIPPostEncode in libtiff.a(tif_zip.o)
      _ZIPEncode in libtiff.a(tif_zip.o)
I verified that by manually running the build of that conftest.c and adding "-lz' to the link line and it built successfully.

Why isn't configure adding -lz to the linker line? Is it a missing dependency somewhere or is my system messing it up?

My configure options:

Code: Select all

./configure --disable-installed --disable-shared --enable-delegate-build --prefix=/Users/Dave/projects/ImageMagick --disable-dependency-tracking --without-x --without-perl --without-magick-plus-plus --without-bzlib --without-xml --without-lzma --with-zero-configuration --disable-docs
The compile/link line (from config.log) that is missing the -lz:

Code: Select all

configure:33746: checking for TIFFOpen in -ltiff
configure:33771: gcc -o conftest -I/Users/Dave/projects/ImageMagick/include/libpng16 -I/Users/Dave/projects/ImageMagick/include/freetype2 -I/Users/Dave/projects/ImageMagick/include -I/Users/Dave/projects/ImageMagick/include/libpng16 -I/Users/Dave/projects/ImageMagick/include   -g -O2 -Wall -mtune=sandybridge -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/jpeg -I/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/png -I/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/tiff/libtiff -I/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/zlib  -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/jpeg/.libs -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/jpeg -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/png/.libs -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/png -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/tiff/libtiff/.libs -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/tiff/libtiff -L/Users/Dave/projects/ImageMagick/ImageMagick-7.0.3-9/zlib conftest.c -ltiff  -ljpeg  -lm    >&5

Thanks,
Dave
DaveBurns
Posts: 4
Joined: 2016-12-07T22:59:43-07:00
Authentication code: 1151

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by DaveBurns »

Meant to add: XCode 8.1, IM 7.0.3-9, and libtiff 4.0.4.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by fmw42 »

Did you install from source or binary?

What do you get from

convert -version

Does it list tiff?

What do you get from

convert -list format

What does that show for TIFF?

I do not know what is wrong. But an alternate method of installing, is to install all delegates from MacPorts and install IM from source. That works great for me. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202
DaveBurns
Posts: 4
Joined: 2016-12-07T22:59:43-07:00
Authentication code: 1151

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by DaveBurns »

Everything from source.

The delegates listed did not include tiff. If I build reconfigure and build libtiff with "--disable-pixarlog --disable-zlib" then IM's configure can build the tiff tests and builds fine.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by fmw42 »

Sorry, I am not an expert on installing libtiff.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by fmw42 »

When you installed libtiff, there should be a config.log file that might tell you what went wrong. Or it might have installed in some place that IM did not expect.
DaveBurns
Posts: 4
Joined: 2016-12-07T22:59:43-07:00
Authentication code: 1151

Re: Configure bug? Building with libtiff on macOSX 10.12

Post by DaveBurns »

Nothing goes wrong with the libtiff build itself. It builds cleanly. The issue seems to be the linker line in ImageMagick's configure script when it tests to see if libtiff is acceptable. The test is broken: libtiff is just fine but the test does not include -lz. The test thinks that, because it fails, the issue is with libtiff but the issue is the test itself.

Now, is the test broken because there's a bug in IM's configure script? Or is it doing the wrong thing because of something in my environment? I don't know autoconf so I can't say.

For IM and all delegates, I specify the --prefix option so when I run install on them, they all go in the same place. This way, pkg-config correctly picks the right library paths and libraries. So I think the installation is not an obstacle.

db
Post Reply