PDA

View Full Version : static binary trying to find libpng?


Highwind
04-11-2012, 05:47 PM
Hi,

I build a static binary gui (using wxwidgets etc.).
otool -L shows nothing but if I run it on a fresh mac (same version 10.6.8) it prints:

dyld: Library not loaded: /usr/local/lib/libpng14.14.dylib

Referenced from: /Users/noname/Downloads/mygui.app/Contents/MacOS/mygui
Reason: image not found

Trace/BPT trap

So why is it looking for libpng if otool does not show a dependency?

Thanks

dmacks
04-11-2012, 10:34 PM
otool -L /Users/noname/Downloads/mygui.app/Contents/MacOS/mygui

has nothing?

Highwind
04-12-2012, 01:42 PM
no, nothing

Highwind
04-12-2012, 03:10 PM
ha, the reason was the binary was packed with upx.
Running otool on the unpacked version shows all kinds of dependencies (including the libpng).
So from here I can probably figure it out.
Is it better to link statically to libpng or is there a dynamic library installed by default (maybe in a different location) that should better be used? there is other dynamic stuff like libcrypto, libSystem, libexpat, libz, libiconv.2, libstdc++.6, libobjc.A Will they be available on a fresh user system?

Thanks