Boost logo

Boost :

Subject: [boost] [Build] Create test with shared library linked against current Boost link-variant
From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2018-05-14 11:47:45


Hi,

I discovered a severe bug in Boost.Serialization and am trying to
contribute a test to the test suite to reproduce that behavior. I have a
minimum example which runs into this (see also
https://stackoverflow.com/questions/50064617/order-of-destruction-for-static-function-members-in-shared-libraries)
but I'm having trouble getting that into the Jamfile.

What I need: 2 shared libraries linked against the currently tested
Boost link-variant and link those into an executable not linked against
Boost. So testcase a) would be against Boost-Shared and b) against
Boost-Static. But in all cases the libraries itself must be shared.

What I have:

lib multi_shared_1
 Â Â Â  :
 Â Â Â Â Â Â Â  multi_shared1.cpp
 Â Â Â Â Â Â Â  ../build//boost_serialization
 Â Â Â  :
 Â Â Â Â Â Â Â  <link>shared
 Â Â Â  ;

lib multi_shared_2
 Â Â Â  :
 Â Â Â Â Â Â Â  multi_shared2.cpp
 Â Â Â Â Â Â Â  ../build//boost_serialization
 Â Â Â  :
 Â Â Â Â Â Â Â  <link>shared
 Â Â Â  ;

... [ test-bsl-run test_multi_shared_lib : : multi_shared_1 multi_shared_2 ]

Problem: This links against Boost-Shared even with "./b2 link=static"
My best approach so far is to change "../build//boost_serialization" to
"../build//boost_serialization/<link>static" but then I cannot test
testcase a) (Boost-Shared) anymore. Also it does link other
Boost-Libraries (filesystem, system) shared, not static. Furthermore I'd
need to add `-fPIC` to the cxxflags of the boost libraries. This is
minor as it can be done in the `.travis` file but I'd rather have it in
the Jamfile so it is not missed in other test-environments.

How can I achieve this? I'm not to familiar with the Jamfiles so this is
basically all I could find so far.

Thanks,
Alexander Grund


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