Linking Against ROOT dylibs in XCode

A little bit of history: a few months ago I had no problems linking against the ROOT dylibs with XCode 2 in Mac OS X 10.4. I used fink for the ROOT installation and all was well in the world.

After upgrading to 10.5 I opted to use the precompiled binaries from the ROOT website and had no problems running ROOT itself. When I try to link against the dylibs in XCode 3.0, however, problems arise. Header and library search paths have been set correctly, and indeed the executable compiles without problem. Unfortunately the linking is not being done correctly, and instead of using my library search paths it’s defaulting to that defined in the dylib itself. When run the executable dies with the error

dyld: Library not loaded: /Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libCore.dylib
Reason: image not found

otool seconds this, showing that the executable was linked to the path above

14:22:52[~/Documents/MIT/Research/Machine Learning/GP/fastGaussianProcess/build/Debug]-Zeplin: otool -L test
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libCore.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libGpad.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libGraf.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libHist.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libRIO.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/bellenot/ROOT/osx104_ppc_gcc401/root/lib/libTree.dylib (compatibility version 0.0.0, current version 0.0.0)

At this point all that I can guess is that for some reason the LC_ID_DYLIB in the ROOT dylibs is overwriting my own library search paths defined within the XCode project in LIBRARY_SEARCH_PATHS.

I know it’s a pretty specific situation, but I was hoping bellenot might be around and provide some insight into how the OS X binaries were compiled. Thanks for any help.

-M. Betancourt