Boost logo

Boost :

Subject: [boost] [filesystem][iostreams][program_options] linker issues on msvc
From: Alexander Arhipenko (arhipjan_at_[hidden])
Date: 2009-11-20 04:38:36


Guys,

We use boost.build not only for building boost but also to create own
binary packages. For a long time I observe linker errors on msvc due
to lack of usage requirements in Jamfile's.
Issue is reproduced when somebody builds executable like this:

exe foo : main.cpp /boost/filesystem ; #or /boost/program_options or
/boost/iostreams

Following trivial patch resolves these issues:

Index: libs/program_options/build/Jamfile.v2
===================================================================
--- libs/program_options/build/Jamfile.v2 (revision 57802)
+++ libs/program_options/build/Jamfile.v2 (working copy)
@@ -1,6 +1,9 @@

 project boost/program_options
     :
+ usage-requirements
+ <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK=1
+ :
     source-location ../src
     ;

@@ -17,4 +20,4 @@
     <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK=1 # tell
source we're building dll's
     ;

Index: libs/filesystem/build/Jamfile.v2
===================================================================
--- libs/filesystem/build/Jamfile.v2 (revision 57802)
+++ libs/filesystem/build/Jamfile.v2 (working copy)
@@ -11,6 +11,7 @@
 project boost/filesystem
     : source-location ../src
     : usage-requirements # pass these requirement to dependents (i.e. users)
+ <library>/boost/system
       <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
       <link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
     ;
@@ -29,4 +30,4 @@
     :
     ;

Index: libs/iostreams/build/Jamfile.v2
===================================================================
--- libs/iostreams/build/Jamfile.v2 (revision 57802)
+++ libs/iostreams/build/Jamfile.v2 (working copy)
@@ -7,7 +7,11 @@

 # See http://www.boost.org/libs/iostreams for documentation.

-project /boost/iostreams : source-location ../src ;
+project /boost/iostreams
+ : usage-requirements
+ <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
+ : source-location ../src
+ ;

 # The biggest trick in this Jamfile is to link to zlib and bzip2 when
 # needed. To configure that, a number of variables are used, which must

Regards


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