fix Boost::unit_test_framework
linkage -- don't mix header & static library usage variants
#337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Boost unit test framework can be used via header-only or by linking to a static library (or dynamic library). See https://www.boost.org/doc/libs/1_85_0/libs/test/doc/html/boost_test/usage_variants.html. Mixing these up can cause linker failures and/or ODR violations. If this sounds familiar, we previously had a mix ups fixed in AntelopeIO/leap#807. It appears we've mixed these up again in leap5 with the boost submodularization.
For example, in fc,
spring/libraries/libfc/CMakeLists.txt
Lines 105 to 106 in 09d979b
The
Boost::unit_test_framework
target will link the Boost unit test static library. But then intest_fc
the header-only usage variant is used,spring/libraries/libfc/test/main.cpp
Lines 1 to 2 in 09d979b
(of course, libfc linking to
Boost::unit_test_framework
is also undesirable on its own -- there is no reasonnodeos
should be linking to boost unit test framework)This PR removes the
Boost::unit_test_framework
linkage from a number of base libraries -- appbase, fc, and chainbase -- and then adds the appropriate header-onlyBoost::included_unit_test_framework
target where it is used. (curiously,chainbase_test
appears to be the only remaining test leveraging the static library approach. I've left it as is, there is nothing wrong with that.)Requires,
Boost::unit_test_framework
's static library as part of appbase library appbase#33Boost::unit_test_framework
's static library as part of chainbase library chainbase#49