Boost logo

Boost Users :

Subject: [Boost-users] Linker not pulling in boost_system properly
From: Jason Sewall (jasonsewall_at_[hidden])
Date: 2009-11-19 18:02:33


I'm having trouble with linking to an installation of Boost. I just
downloaded boost_1_41_0.tar.bz2, untarred it, and did:

$ ./bootstrap.sh --prefix=/home/sewall/src/boost-1.41.0
$ ./bjam --prefix=/home/sewall/src/boost-1.41.0 install

Now I've got a project (using autotools+libtool) of my own making that
uses a number of Boost libraries. After pointing the configure script
to the right spot for the Boost libraries, I wind up with errors like
the following:

/bin/sh ../libtool --tag=CXX --mode=link g++ -I../sim/include
-I/home/sewall/src/boost-1.41.0/include -I/usr/include/libxml2
-fopenmp -O0 -fno-inline -ggdb -Wall -Wextra -Wno-unused-parameter
-Wno-enum-compare -o xml-test xml-test.o ../sim/src/libhwm_net.la
-lrt
libtool: link: g++ -I../sim/include
-I/home/sewall/src/boost-1.41.0/include -I/usr/include/libxml2
-fopenmp -O0 -fno-inline -ggdb -Wall -Wextra -Wno-unused-parameter
-Wno-enum-compare -o xml-test xml-test.o
../sim/src/.libs/libhwm_net.a -L/home/sewall/src/boost-1.41.0/lib
-lxml2 -lz -lboost_filesystem -lboost_regex -lrt
/usr/bin/ld: warning: libboost_system.so.1.41.0, needed by
/home/sewall/src/boost-1.41.0/lib/libboost_filesystem.so, not found
(try using -rpath or -rpath-link)
/home/sewall/src/boost-1.41.0/lib/libboost_filesystem.so: undefined
reference to `boost::system::get_system_category()'
/home/sewall/src/boost-1.41.0/lib/libboost_filesystem.so: undefined
reference to `boost::system::get_generic_category()'

I don't claim to understand libtool terribly well, but I think that
the xml-test target is pulling in the dependencies of libhwm_net.la,
which in turn pulls in boost_filesystem and boost_regex. It seems
that it boost_filesystem is then asking for libboost_system.
Everything is acting as it should up to this point, but then the
linker seems to be at a loss to where libboost_system can be found.

If I manually add -lboost_system to the above command line, the target
builds fine. Of course I can just have my configure script general
-lboost_filesystem and -lboost_system whenever boost_filesystem is
needed, but I suspect there's a better way to do it.

Is there something I should have added to my Boost build to have it
know to look for boost_system in /home/sewall/src/boost-1.41.0?

Thanks,
Jason

P.S. I have added /home/sewall/src/boost-1.41.0 to my LD_LIBRARY_PATH,
if that helps.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net