Boost logo

Boost :

Subject: Re: [boost] [build] bjam library path on gcc
From: Max Sobolev (macsmr_at_[hidden])
Date: 2011-04-25 03:10:00


On 25.04.2011 6:54, Lorenzo Caminiti wrote:
> 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.
>

probably in your jamfile.jam you should add dependencies from
appropriate libraries:

exe profile_boost_local : profile_boost_local.cpp
                           /boost//system/
                           /boost//chrono/
                         ;

or

exe profile_boost_local : profile_boost_local.cpp
                         : <library>/boost/system//boost_system
                           <library>/boost/chrono//boost_chrono
                         ;

..or similar

-- 
- Do you speak English? Мужик с глубоким вздохом: - Yes I do. А хули толку?

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