Boost logo

Boost :

Subject: [boost] [build] bjam library path on gcc
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-04-24 22:54:08


Hello all,

How do I setup gcc library path (LD_LIBRARY_PATH) for bjam?

For example I get this error when using bjam:

lcaminiti_at_lcaminiti-PORTEGE-R700:~/sandbox/boost-sandbox-local/libs/local/example$
bjam -q profile_boost_local toolset=gcc
...patience...
...found 790 targets...
...updating 2 targets...
gcc.compile.c++ bin/gcc-4.5.1/debug/profile_boost_local.o
gcc.link bin/gcc-4.5.1/debug/profile_boost_local
bin/gcc-4.5.1/debug/profile_boost_local.o: In function `main':
/home/lcaminiti/sandbox/boost-sandbox-local/libs/local/example/profile_boost_local.cpp:17:
undefined reference to `boost::chrono::system_clock::now()'
/home/lcaminiti/sandbox/boost-sandbox-local/libs/local/example/profile_boost_local.cpp:23:
undefined reference to `boost::chrono::system_clock::now()'
/home/lcaminiti/sandbox/boost-sandbox-local/libs/local/example/profile_boost_local.cpp:31:
undefined reference to `boost::chrono::system_clock::now()'
/home/lcaminiti/sandbox/boost-sandbox-local/libs/local/example/profile_boost_local.cpp:33:
undefined reference to `boost::chrono::system_clock::now()'
bin/gcc-4.5.1/debug/profile_boost_local.o: In function
`__static_initialization_and_destruction_0':
/home/lcaminiti/sandbox/boost-trunk/boost/system/error_code.hpp:214:
undefined reference to `boost::system::generic_category()'
/home/lcaminiti/sandbox/boost-trunk/boost/system/error_code.hpp:215:
undefined reference to `boost::system::generic_category()'
/home/lcaminiti/sandbox/boost-trunk/boost/system/error_code.hpp:216:
undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status

    "g++" -o "bin/gcc-4.5.1/debug/profile_boost_local"
-Wl,--start-group "bin/gcc-4.5.1/debug/profile_boost_local.o"
-Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -g

...failed gcc.link bin/gcc-4.5.1/debug/profile_boost_local...
...failed updating 1 target...
...updated 1 target...

But I can tell bjam to add -L and -l options as in the following it would work:

lcaminiti_at_lcaminiti-PORTEGE-R700:~/sandbox/boost-sandbox-local/libs/local/example$
g++ -o "bin/gcc-4.5.1/debug/profile_boost_local" -Wl,--start-group
"bin/gcc-4.5.1/debug/profile_boost_local.o" -Wl,-Bstatic
-Wl,-Bdynamic -Wl,--end-group -g
-L/home/lcaminiti/sandbox/boost-trunk/stage/lib -lboost_chrono
-lboost_system

Thank you.

-- 
Lorenzo

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk