Why does link pick up wrong library

Peter O'Gorman peter at pogma.com
Tue Apr 8 21:38:11 PDT 2008


Hi Tim,

Tim Lyons wrote:
>> Check that /opt/local/lib/libfreetype.dylib has the correct install_name:
>>
>> otool -D /opt/local/lib/libfreetype.dylib
>>
> This gives
> tim$ otool -D libfreetype.dylib
> libfreetype.dylib:
> /usr/local/lib/libfreetype.6.dylib
> 
> So the 'install name' of the library is
> /usr/local/lib/libfreetype.6.dylib. But what does this mean?

The dynamic linker, dyld, will look for
/usr/local/lib/libfreetype.6.dylib when it tries to run an application
which has been linked against this library. It will not find it and will
exit the app like below.

> dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
>   Referenced from:
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gnome_gnome-python-extras/work/gnome-python-extras-2.19.1/./conftest
> 
>   Reason: image not found
> Trace/BPT trap
> 
> Is libfreetype built wrongly? What should I do to correct it? freetype
> was installed using MacPorts, and seemed to install successfully.

Rebuild freetype, if it still has the same install_name, file a bug.
When it has a correct install_name, you will, unfortunately, have to
rebuild everything that uses freetype.

> I don't understand why it refers to 10.16.0, when the build was 2.3.5.

The versions of libraries do not need to match the package version.

Hope this helps,
Peter
-- 
Peter O'Gorman
http://pogma.com


More information about the macports-users mailing list