Hi all,
I'm having newbie problems with linking against Boost libraries. Here's
the situation:
I can build the boost libraries without problem, and I'm using the
default toolkit for my system, (Fedora Core 1) which is g++.
Compiling is no problem, just linking. I can link the object files by
hand, but not as part of using Boost.build.
As a test, I grabbed an example program from the date_time library and
it's corresponding build rule. This code compiles fine as part of Boost,
but if I move it to my project space, I get linking errors.
Here's my Jamfile:
exe time_math : <lib>$(BOOST_ROOT)/build/boost_date_time
time_math.cpp
: <include>$(BOOST_ROOT)
<define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG ;
and here's my Jamrules in the same directory:
project-root ;
path-global BOOST_ROOT : "/opt/boost-1.30.2" ;
Here's the Jamfile from /opt/boost-1.30.2/libs/date_time/example/
exe time_math : <lib>../build/boost_date_time
posix_time/time_math.cpp
: <include>$(BOOST_ROOT)
<define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
And the environment variable is set:
BOOST_BUILD_PATH=/opt/boost-1.30.2/tools/build
When I run bjam from a clean build, here's what I get:
gcc-C++-action bin/time_math/gcc/debug/runtime-link-dynamic/time_math.o
gcc-Link-action bin/time_math/gcc/debug/runtime-link-dynamic/time_math
bin/time_math/gcc/debug/runtime-link-dynamic/time_math.o(.gnu.linkonce.t._ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_13simple_formatEE12format_monthERKS3_RSo+0x3a): In function `boost::date_time::month_formatter
On Fri, 30 Jan 2004 22:48:20 -0700, Michael Buksas wrote
Hi all,
I'm having newbie problems with linking against Boost libraries. Here's the situation:
I can build the boost libraries without problem, and I'm using the default toolkit for my system, (Fedora Core 1) which is g++.
Compiling is no problem, just linking. I can link the object files by hand, but not as part of using Boost.build.
First off, what version of bjam and boost are you using? I'm going to assume version 1.30.2 of boost.
As a test, I grabbed an example program from the date_time library and it's corresponding build rule. This code compiles fine as part of Boost, but if I move it to my project space, I get linking errors. ... ... details omitted... ... So things are compiling, but not linking.
I must not have the configuration for Boost.build correct, but I've tried everything I can think of. Any help would be appreciated.
I think that bjam isn't that great at compiling outside of the boost directory tree in the 1.30.2 version (I'm sure someone will correct me if I'm offbase here :). Here's what I do on Linux. I go into libs/date_time/build and run bjam. You will see a bin/libboost_date_time.a/gcc/... directory appear. If you troll down the directory eventually you will find the libboost_date_time.a file. Then I copy this file into a well known location like BOOST_ROOT/bin and then simply include that into my makefile using -L and -l. I believe in the next release there is some sort of bjam --install option that will do all this for you, but I don't know the details. You might want to post on the Jamboost list about that: http://www.boost.org/more/mailing_lists.htm#jamboost HTH, Jeff
participants (2)
-
Jeff Garland
-
Michael Buksas