Question

When I try to compile an exec with b2 toolset=clang it uses a linking command like :

clang++ -L/apps/bzip2/lib -L/apps/zlib/lib -o fixfast/bin/clang-linux-3.3/release/link-static/fixfast-mds_MCAST fixfast/bin/clang-linux-3.3/release/link-static/fixfastDataD.o /apps/boost/root/bin.v2/libs/date_time/build/clang-linux-3.3/release/link-static/libboost_date_time.a ~/infra_install/lib/libfixfast.a ~/infra_install/lib/libCDef.a -lbz2 -lz -lpthread

and fails with a long list of undefined references in boost, whereas the following reordered version of it links fine :

clang++ -L/apps/bzip2/lib -L/apps/zlib/lib -o fixfast/bin/clang-linux-3.3/release/link-static/fixfast-mds_MCAST fixfast/bin/clang-linux-3.3/release/link-static/fixfastDataD.o ~/infra_install/lib/libfixfast.a ~/infra_install/lib/libCDef.a /apps/boost/root/bin.v2/libs/date_time/build/clang-linux-3.3/release/link-static/libboost_date_time.a  -lbz2 -lz  -lpthread

I believe the way I am specifying linking dependency of libCDef on /boost/date_time//boost_date_time is probably not enough to have the right order during linking.

CDef/Jamroot :

project : usage-requirements <include>~/infra_install ;

lib CDef 
  : [ glob *.cpp ] 
  : 
  <library>/boost/date_time//boost_date_time
  <library>/boost/filesystem//boost_filesystem
  <library>/boost/system//boost_system
  <library>/boost/iostreams//boost_iostreams
  <link>static 
  ;

install libCDef
  : CDef
  : <install-type>LIB
    <variant>release:<location>"~/infra_install/lib"
  : release
  ;

I need to specify that CDef depends on boost_date_time and hence the linker should order it as such.

Was it helpful?

Solution

Based on http://www.boost.org/boost-build2/doc/html/bbv2/faq/liborder.html This was contributed by Steven Watanabe. I tried to help the linker by using <use> commands. While that worked for gcc, for clang-linux and intel-linux it did not.

Then Kohei Takashi enlightened me to the solution, which was to amend clang-linux.jam and intel-linux.jam

https://svn.boost.org/trac/boost/ticket/5820

Unfortunately this was conversation was on the boost.build email group, but thanks guys!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top