Trouble distributing application that links to MacPort libraries

Peter Schmitt pschmittml at gmail.com
Thu Mar 29 15:17:04 PDT 2012


Hi macports-users!

I installed some ports on a build machine. I then build my application
and `otool -L myApp.binary` shows dependencies on some MacPorts
libraries installed at /opt/local/lib. myApp.binary runs fine on this
build machine.  In order to deploy my application to other machines, I
copy the corresponding libraries to "myApplication/darwin-libs" and
write a wrapper script at "myApplication/launchMyApp.sh" which looks
something like this:

>
>  #!/bin/env sh
>  # this is "launchMyApp.sh".
>  export DYLD_LIBRARY_PATH=/path/to/myApplication/darwin-libs
>  /path/to/myApplication/myApp.binary.
>

Now when I run launchMyApp.sh on either the build or the user machine,
I get an error:

>  dyld: Symbol not found: _iconv
>    Referenced from: /usr/lib/libcups.2.dylib
>    Expected in: /path/to/myApplication/darwin-libs/libiconv.2.dylib
>   in /usr/lib/libcups.2.dylib

The confusing thing is that libcups.2.dylib isn't used anywhere in my
application: `otool -L myApp.binary` and all the libraries in
/opt/local/lib/* do not resolve any reference to
/usr/lib/libcups.2.dylib! I can "fix" the problem by either

>
> cp /usr/lib/libcups.2.dylib /path/to/myApplication/darwin-libs
>
or appending

>
>DYLD_LIBRARY_PATH+=/usr/lib
>

to launchMyApp.sh. I only get this behavior when running
launchMyApp.sh on OSX 10.7 (Lion) machines. The whole procedure seems
to work fine on Leopard and Snow Leopard machines.  Any idea of what's
going on here?

I found a ticket describing simliar behavior (ticket #32348
[https://trac.macports.org/ticket/32348]).  I added my findings and
figured someone on macports-users might have an idea of what I'm doing
wrong.  Has anyone else ran into this problem?

Thanks,
Pete


More information about the macports-users mailing list