reactivemarkets / toolbox-cpp

The Reactive C++ Toolbox is an open source library of C++20 components designed for efficient, asynchronous network applications on the Linux platform.
https://reactivemarkets.github.io/toolbox-cpp/
Other
21 stars 20 forks source link

fix(build): undefined reference to unit_test_main #157

Closed markaylett closed 3 years ago

markaylett commented 3 years ago

Statically compiled unit-test applications were failing with the following error:

Main.ut.cpp:(.text.startup+0xd): undefined reference to `boost::unit_test::unit_test_main(bool (*)(), int, char**)' collect2: error: ld returned 1 exit status

This happens due conflicting use of Boost_USE_STATIC_LIBS and BOOST_TEST_DYN_LINK when shared builds are disabled but boost shared libraries are available. In this case the build sets the BOOST_TEST_DYN_LINK option even though Boost_USE_STATIC_LIBS is also set.

The solution is not to force the use of Boost static libraries, because it leads to more complex and unpredictable build scenarios with minimal benefit.

DEV-3433