Building ImageMagick on OSX Lion and can't link libpng

4

1

I am trying to build ImageMagick 6.8.0-5 on OSX Lion with support for libpng. I am just using the standard ./configure make make install procedure.

I succeed in compiling when I do not reference libpng.

./configure --with-png=no
make

However, I get an error in make when I try to add libpng support. (libpng-1.5.13)

./configure --with-png=yes
make

The error seems to be a linker error.

/usr/bin/nm: no name list
ld: warning: cannot export hidden symbol _SyncImagePixelCache from magick/.libs/magick_libMagickCore_la-cache.o
ld: warning: cannot export hidden symbol _ResetQuantumState from magick/.libs/magick_libMagickCore_la-quantum.o
Undefined symbols for architecture x86_64:
  "_png_set_check_for_invalid_index", referenced from:
      _WriteOnePNGImage in magick_libMagickCore_la-png.o
      _ReadOnePNGImage in magick_libMagickCore_la-png.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [magick/libMagickCore.la] Error 1
make: *** [all] Error 2

I have not changed any other options to configure.

How can I fix this to add libpng support?

martin jakubik

Posted 2012-11-25T19:52:09.597

Reputation: 124

Running into this same issue. Did you ever figure it out? So far I've had to run without PNG support... – Brian Moeskau – 2013-01-09T18:21:34.963

haven't figured it out. my colleague also ran into it since then, but I think he fixed it just by using a pre-built binary from somewhere. I haven't had a chance to ask him but I'll try. – martin jakubik – 2013-01-10T09:14:31.657

Answers

2

You'll need to tell ImageMagick where to locate libpng. Luckily, libpng ships with a configuration script entitled "libpng-config".

You can get the link-library option form your local libpng install with the --L_opts flag.

libpng-config --L_opts

This will return something like -L/usr/local/lib. Set ImageMagick's LDFLAGS configuration to match your libpng library.

# Use the returned value for the LDFLAGS
./configure LDFLAGS='-L/usr/local/lib'

If libpng-config returns with a message 'command not found', you'll need to ensure your libpng is installed correctly, and can be located in your shell environment. Often, this can be as simple as adding a custom path to your PATH variable.

export PATH="$PATH:/usr/local/bin"

emcconville

Posted 2012-11-25T19:52:09.597

Reputation: 396

1

Had trouble getting ImageMagick to build correctly with png support on 10.10 myself, so I just used the installer from http://cactuslab.com/imagemagick/ which includes png support. (installs in /opt)

Pieter

Posted 2012-11-25T19:52:09.597

Reputation: 543

0

Newer ImageMagick versions seems to rely on "pkg-config" to find your own libpng build. I just installed pkg-config and set PKG_CONFIG_LIBRARY=/path/to/my/libpng-version for it to work.

HTH, Axel.

Axel

Posted 2012-11-25T19:52:09.597

Reputation: 1