Boost logo

Boost-Build :

Subject: [Boost-build] OSX linker question
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-08-30 04:05:38

3 of Boost.Build regression tests are failing on OSX, and here are the commands
that capture the essense of the failure:

    "/usr/bin/g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -dynamic -no-cpp-precomp -gdwarf-2 -Wno-long-double -fPIC
     -c -o "a/bin/darwin-4.0.1/debug/a.o" "a/a.cpp"

    "/usr/bin/g++" -dynamiclib -Wl,-single_module -install_name "liba.dylib"
    -o "a/bin/darwin-4.0.1/debug/liba.dylib" "a/bin/darwin-4.0.1/debug/a.o" -headerpad_max_install_names -g

    "/usr/bin/g++" -dynamiclib -Wl,-single_module -install_name "libb.dylib" -o "b/bin/darwin-4.0.1/debug/libb.dylib"
    "b/bin/darwin-4.0.1/debug/b.o" "a/bin/darwin-4.0.1/debug/liba.dylib" -headerpad_max_install_names -g

    "/usr/bin/g++" -o "bin/darwin-4.0.1/debug/main" "bin/darwin-4.0.1/debug/main.o" "b/bin/darwin-4.0.1/debug/libb.dylib" -g
     /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning can't open dynamic library: liba.dylib referenced from:
     b/bin/darwin-4.0.1/debug/libb.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
     /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
     geek() referenced from libb expected to be defined in liba.dylib

The goal here is to have library b depend on library a in another directory. Then, executable main links
only to b. It should be possible to pick a automatically. On Linux, this is achieved by passing
-rpath-link option when linking 'main', with the path to 'a'. However, it
does not seem like it's available on OSX. So, I have two questions:

1. What option(s) should I use to avoid the above error at link time?
2. What options should I use to make 'main' find both liba and libb at
runtime, without explicit setting of DYLD_LIBRARY_PATH?


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