views:

845

answers:

5

It seems that I have more trouble getting standard Unix things to run on Snow Leopard than any other platform--including Windows cygwin

For the past couple of days, I've been trying to get ImageMagick to run on Snow Leopard.

The most obvious way, Mac Ports, fails:

tppllc-Mac-Pro:ImageMagick-sl swirsky$ sudo port install imagemagick
--->  Computing dependencies for p5-locale-gettext
--->  Configuring p5-locale-gettext
Error: Target org.macports.configure returned: configure failure: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_perl_p5-locale-gettext/work/gettext-1.05" && /opt/local/bin/perl Makefile.PL INSTALLDIRS=vendor " returned error 2
Command output: checking for gettext... no
checking for gettext in -I/opt/local/include -arch i386 -L/opt/local/lib -lintl...gettext function not found. Please install libintl at Makefile.PL line 18.
 no

Error: Unable to upgrade port: 1
Error: Unable to execute port: upgrade xorg-libXt failed
Before reporting a bug, first run the command again with the -d flag to get complete output.
tppllc-Mac-Pro:ImageMagick-sl swirsky$ 

Not wanting to spend another two days figuring out why my libintl doesn't have a "gettext" function, I tried a different route: the script mentioned here: http://github.com/masterkain/ImageMagick-sl

This script downloads and installs an ImageMagic independently of MacPorts issues

tppllc-Mac-Pro:ImageMagick-sl swirsky$ /usr/local/bin/convert
dyld: Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: /opt/local/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
Trace/BPT trap

It downloads everything and compiles fine, but fails when I try to run it, with the message above.

So now I'm two steps away from ImageMagick, trying to get a newer libiconv on my machine.

I downloaded the latest libiconv, compiled and built it. I put the resulting library in /opt/local/lib, and I still get the same error message:

tppllc-Mac-Pro:.libs swirsky$ sudo mv libiconv.2.dylib /opt/local/lib/libiconv.2.dylib
tppllc-Mac-Pro:.libs swirsky$ convert
dyld: Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: /opt/local/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
Trace/BPT trap

Now here's something interesting. The error message shows it's looking in /opt/local/lib/libiconv.2.dylib.

otools -L shows that this does implement 8.0.0:

tppllc-Mac-Pro:.libs swirsky$ otool -L /opt/local/lib/libiconv.2.dylib
/opt/local/lib/libiconv.2.dylib:
    /usr/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)
tppllc-Mac-Pro:.libs swirsky$ 

And, for good measure, I set the DYLD_LIBRARY_PATH to make sure this directory is the one for dynamic libraries.

So even though I do have a library that provides 8.0.0, it's being seen as 7.0.0! Any ideas why this would happen?

So here's my question: Is it possible to get ImageMagick to run on OSX Snow Leopard? Are there any binary distributions that have static libraries baked in so I don't have to worry about these issue/

+1  A: 

My google showed up a few hits, and the first or second one had a link to the binary.

extraneon
Thanks! I saw that page, but missed it because it first recommended using MacPorts. The binary distribution does seem to work. (Though I'd much prefer one that had the libraries statically linked. Changing the DYLD_LIBRARY_PATH environment variable breaks other things...)
ראובן
A: 

I was finally able to get my "macports" installation consistent enough to get imagemagick installed and running. I had to manually delete my /opt/local/ directores where the files lived, and clean out some other dependencies.

ראובן
Nope! I spoke too soon. It compiles and builds, but doesn't run. Every operation dies in an "Abort Trap".
ראובן
A: 

It seems that the dynamic linker is pulling in the system libiconv.2.dylib (which has compatibility version 7.0.0). Without seeing your entire build process it's hard to know for sure why this is, but I'm suspicious of your libiconv build; note that in the following failure:

tppllc-Mac-Pro:.libs swirsky$ otool -L /opt/local/lib/libiconv.2.dylib
/opt/local/lib/libiconv.2.dylib:
    /usr/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)

your libiconv.2.dylib seems to think that its install path is /usr/local/lib, not /opt/local/lib. This probably why the dynamic linker isn't finding it; it's looking for it in /usr/local/lib, not finding it, and falling back on the system library in /usr/lib. Try setting the install path for your libiconv.2.dylib so that it's load commands tell the linker to look for it in /opt/local/lib, and that may resolve the issue.

Stephen Canon
A: 

I've seen this exact error with this exact library in multiple situations. It was, in every case, an instance where either the individual or an script they were using was setting the DYLD_LIBRARY_PATH variable.

Make sure this variable is not being set as it overrides loading the explicitly linked libraries with those at that path.

If the DYLD_* must be set, use the more sane DYLD_LIBRARY_FALLBACK_PATH. Which will attempt to load the explicitly linked libraries first, then fallback to the user declared ones.

I did notice on your initial build that it was not finding the gettext library in macports. So make sure those are installed.

jkyle
+1  A: 

You may also try the ImageMagick install script located here: http://github.com/masterkain/ImageMagick-sl

It helped me a lot. May be needed to change some library versions inside the script.