Boost logo

Boost-Build :

Subject: [Boost-build] OS X: use of DYLD_FALLBACK_LIBRARY_PATH
From: Jeroen van der Wulp (J.v.d.Wulp_at_[hidden])
Date: 2008-10-29 07:10:28

Hello Everyone,

Using the run rule in testing.jam sets the DYLD_LIBRARY_PATH environment
variable before running an executable. This usually works, but recently
we found a case where this actually causes conflicts between libraries
OS X framework and standard open source libraries installed for example
through MacPorts.

I believe that DYLD_LIBRARY_PATH doesn't do the correct thing in this
case. When linking a library that links against a library of which the
location is known, e.g. /opt/local/lib/libjpeg.62.dylib (occurs like
this in otool output of the library linked against), then it discards
the path information and starts looking into paths specified in
DYLD_LIBRARY_PATH variable. In the case of libjpeg the framework library
libJPEG will be found, which is incompatible (Symbol not found:

Using the DYLD_FALLBACK_LIBRARY_PATH variable seems to solve the
problem. The paths listed in this variable are consulted only if
libraries cannot be found in another way (more akin to LD_LIBRARY_PATH
on other Unix systems). I like to propose the attached patch.


Jeroen van der Wulp

Index: 3rd-party/boost/tools/build/v2/util/os.jam
--- 3rd-party/boost/tools/build/v2/util/os.jam (revision 5032)
+++ 3rd-party/boost/tools/build/v2/util/os.jam (working copy)
@@ -71,7 +71,7 @@
 .shared-library-path-variable-CYGWIN = PATH ;
-.shared-library-path-variable-MACOSX = DYLD_LIBRARY_PATH ;
+.shared-library-path-variable-MACOSX = DYLD_FALLBACK_LIBRARY_PATH ;
 .shared-library-path-variable-AIX = LIBPATH ;

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at