General OS X question: DYLD_LIBRARY_PATH and install name

C. Florian Ebeling florian.ebeling at gmail.com
Thu Oct 30 01:14:04 PDT 2008


On Wed, Oct 29, 2008 at 10:49 PM, Bryan Blackburn <blb at macports.org> wrote:
> On Wed, Oct 29, 2008 at 10:30:17PM +0100, C. Florian Ebeling said:
>> I recently came across the statement that one needs to set the DYLD_LIBRARY_PATH
>> variable if you want to run an executable linked against a dynamic
>> library which is not to be found
>> in any of the standard locations (~/lib:/usr/lib:/usr/local/lib). That
>> is the case for all mp installed
>> libraries, I'd say. My immediate reaction was that this is not true,
>> and that everything is fine
>> without the variable as long as `otool -L' points to the right
>> location. So the "install name" counts.
>
> You might be commingling two different, but similar, ideas: an item
> can be linked directly against a dylib (eg, what you see with 'otool -L')
> and you can load a dylib (or bundle) at runtime using dlopen().

True, actually. I mixed those two up, even though I kind of know the
difference.

I think the dyld(1) documentation could be made a bit clearer
on this matter, because it didn't reduce my confusion. I do
realize that this is not the right place to complain about apple
documentation, though. :)

So, for usual operation of something linked against mp libs, no
DYLD_* environment variables have to be set. This might be different if
you deal with plugin-like objects opened by dlopen, which is
probably an exceptional case, but in general the rule holds. Right?

Florian


-- 
Florian Ebeling
Twitter: febeling
florian.ebeling at gmail.com


More information about the macports-dev mailing list