Creating a Portfile for BirdFont

Clemens Lang cal at macports.org
Mon Feb 25 14:15:54 PST 2013


On Mon, Feb 25, 2013 at 04:58:43PM +0100, Johan Mattsson wrote:
> Could not open /usr/local/lib/libbirdfont.dylib: Error opening or
> reading file (referenced from /opt/local/bin/birdfont)
> DEBUG: Marking /opt/local/bin/birdfont as broken
> DEBUG: Marking /opt/local/bin/birdfont-export as broken

The problem seems to be that while your Portfile builds a library called
libbirdfont.dylib, the path the library uses to identify itself (the
so-called ID loadcommand) does not correctly contain
	/opt/local/lib/libbirdfont.dylib,
but
	/usr/local/lib/libbirdfont.dylib.

You can check this by using otool -D libbirdfont.dylib and/or otool -L
libbirdfont.dylib. (the former gives only the ID line, the latter all
load commands, where the ID is the first line).

Now when the birdfont and birdfont-export binaries are linked they link
against this library, which causes the linker to copy the library's ID
load command into the binary, i.e. referencing
	/usr/local/lib/libbirdfont.dylib.

You can verify this using otool -L birdfont.

The best fix for this problem would be do modify the build system of
birdfont to build the library with the correct path. The easier quickfix
would be to use install_name_tool -id on the library and
install_name_tool -change on the binaries. See man 1 install_name_tool.

> The port seems to work fine despite of this error message. The library
> will be loaded from the correct location (/opt/local/lib/).

This will only be true until you install a different (possibly
incompatible) /usr/local/lib/libbirdfont.dylib. Btw, do you have
DYLD_LIBRARY_PATH or similar set? Test using env | grep DYLD. If you do,
please note that this isn't required for MacPorts and you shouldn't be
doing this.

-- 
Clemens Lang



More information about the macports-users mailing list