Boost logo

Boost-Build :

Subject: [Boost-build] Problem linking to boost shared libraries on Linux
From: Bart³omiej Chalfen (Bartlomiej.Chalfen_at_[hidden])
Date: 2011-10-21 10:01:44


Hi,

I have a problem when linking my app on Linux. I have boost_1_47_0
installed in my home directory (I'm working on remote server and I
don't have access rights to /usr/local/lib).

//----------------------------------------------------------------------------------------

[chalfen_at_wrling38 ~]$ cat user-config.jam
using gcc ;
using boost : 1.47.0 : <include>/home/chalfen/boost/boost_1_47_0
<library>/home/chalfen/boost/boost_1_47_0/stage/lib <layout>system ;

[chalfen_at_wrling38 MT]$ cat boost-build.jam
boost-build "/home/chalfen/boost/boost_1_47_0/tools/build/v2" ;

[chalfen_at_wrling38 MT]$ cat Jamroot.jam
[...]
import boost ;
boost.use-project ;

project :
        requirements
        <include>/boost//headers/<link>shared
        <library>/boost//filesystem/<link>shared
        <library>/boost//thread/<link>shared
        <library>/boost//unit_test_framework/<link>shared
        <library>/boost//serialization/<link>shared
        <library>/boost//date_time/<link>shared
        <library>/boost//regex/<link>shared
        <library>/boost//system/<link>shared
        <target-os>windows:<platform>WinX86
        <target-os>linux:<platform>LinuxX86
        <link>static
;
[...]

[chalfen_at_wrling38 MT]$ bjam MT_WMP_FCMD --fastbuild -j24 address-model=32
WARNING: Fast (but unsafe) builds enabled
...patience...
...found 4052 targets...
...updating 1 target...
gcc.link app/exe/mt_wmp_fcmd
/usr/bin/ld: cannot find -lboost_system
collect2: ld returned 1 exit status

    "g++" -L"/home/chalfen/boost/boost_1_47_0/stage/lib"
-Wl,-rpath-link -Wl,"/home/chalfen/boost/boost_1_47_0/stage/lib" -o
"app/exe/mt_wmp_fcmd" -Wl,--start-group
[... a bunch of .o's and .a's ...]
  -Wl,-Bstatic -Wl,-Bdynamic -lboost_unit_test_framework
-lboost_thread -lboost_system -lboost_serialization -lboost_regex
-lboost_filesystem -lboost_date_time -Wl,--end-group -g -m32 -Wl,-i

...failed gcc.link app/exe/mt_wmp_fcmd...
...failed updating 1 target...

[chalfen_at_wrling38 MT]$ ll /home/chalfen/boost/boost_1_47_0/stage/lib/
total 47M
lrwxrwxrwx 1 chalfen ccusers_flexi 28 Oct 21 15:38
libboost_date_time.so -> libboost_date_time.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 461K Oct 21 15:38
libboost_date_time.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 29 Oct 21 15:38
libboost_filesystem.so -> libboost_filesystem.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 1.3M Oct 21 15:38
libboost_filesystem.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 35 Oct 21 15:38
libboost_prg_exec_monitor.so -> libboost_prg_exec_monitor.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 483K Oct 21 15:38
libboost_prg_exec_monitor.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 24 Oct 21 15:38 libboost_regex.so
-> libboost_regex.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 9.4M Oct 21 15:38 libboost_regex.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 32 Oct 21 15:39
libboost_serialization.so -> libboost_serialization.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 8.8M Oct 21 15:39
libboost_serialization.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 25 Oct 21 15:38
libboost_system.so -> libboost_system.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 71K Oct 21 15:38 libboost_system.so.1.47.0
-rw-r--r-- 1 chalfen ccusers_flexi 12M Oct 21 15:38
libboost_test_exec_monitor.a
lrwxrwxrwx 1 chalfen ccusers_flexi 25 Oct 21 15:38
libboost_thread.so -> libboost_thread.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 623K Oct 21 15:38 libboost_thread.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 38 Oct 21 15:38
libboost_unit_test_framework.so ->
libboost_unit_test_framework.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 7.2M Oct 21 15:38
libboost_unit_test_framework.so.1.47.0
lrwxrwxrwx 1 chalfen ccusers_flexi 33 Oct 21 15:39
libboost_wserialization.so -> libboost_wserialization.so.1.47.0
-rwxr-xr-x 1 chalfen ccusers_flexi 6.6M Oct 21 15:39
libboost_wserialization.so.1.47.0

//----------------------------------------------------------------------------------------

Why can't the linker find boost_system library even though there is
one and the path is passed? Could it be a problem with my boost
installation, maybe some paths not setup properly? Or some missing
property in Jamfiles?
The same Jamfiles work fine on Windows with similar setup.

Any help would be greatly appreciated.

-- 
Bart³omiej Chalfen
GG: 2585725
JID: charfa_at_[hidden]

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk