[Build] Create test with shared library linked against current Boost link-variant

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Build] Create test with shared library linked against current Boost link-variant

Boost - Dev mailing list
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

[Build] Create test with shared library linked against current Boost link-variant

Boost - Dev mailing list
Hi,

for a test case for Boost.Serialization  I need to build shared
libraries, linked against the current boost library variant (shared or
static).

How do I do this in Boost.Build?

Adding `<link>shared` to the library makes it link against shared boost,
but never to static boost. Adding
"../build//boost_serialization/<link>static" will be the other way round
and fails, if `-fPIC` is not passed, which is not the default.

Thanks,
Alexander Grund

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost