Subject: Re: Shared libraries under Mac OS X
To: None <tech-pkg@NetBSD.org>
From: Matthias Scheler <tron@zhadum.org.uk>
List: tech-pkg
Date: 08/08/2006 21:25:28
In article <20060808100159.GA9016@colwyn.zhadum.org.uk>,
	Matthias Scheler <tron@zhadum.org.uk> writes:
> in the last few days I've fixed the "spidermonkey" package so that it
> builds a shared library "libjs" with the proper extension. The library
> does however not work:
> 
> tron@excalibur:~>avidemux2 
> dyld: Library not loaded: Darwin_DBG.OBJ/libjs.dylib
>   Referenced from: /usr/pkg/bin/avidemux2
>   Reason: image not found
> zsh: trace trap  avidemux2
> 
> Any idea what is wrong with the library?

For the record: the solution

The problem was an incorrect path compiled into the library:

tron@excalibur:~>otool -L /usr/pkg/lib/libjs.dylib
/usr/pkg/lib/libjs.dylib:
-->	Darwin_DBG.OBJ/libjs.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.6)

The fix is to link the library with "-install_name /usr/pkg/lib/libjs.dylib".
Thanks a lot to Amitai Schlair who helped me figuring this problem out.

And the good news for the Mac OS X "pkgsrc" users is that the "avidemux"
package now builds and works fine.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/