Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to support building boost dynamic library #83

Open
Char-Aznable opened this issue May 31, 2019 · 6 comments
Open

Add option to support building boost dynamic library #83

Char-Aznable opened this issue May 31, 2019 · 6 comments

Comments

@Char-Aznable
Copy link

I have a usage case where I need to link my app against Boost::unit_test_framework dynamic library with BOOST_TEST_DYN_LINK defined. It seems boost-cmake only builds boost static libraries which causes the error in my use case:

ld: CMakeFiles/mytest.dir/test.cpp.o: in function `main':
test.cpp:(.text+0xad3): undefined reference to `boost::unit_test::unit_test_main(bool (*)(), int, char**)'

I suggest boost-cmake should have an option to allow the users to use either dynamic or static boost libraries

@Char-Aznable
Copy link
Author

Here's the documentation of boost.Test dynamic library usage: https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/boost_test/adv_scenarios/shared_lib_customizations.html

@Orphis
Copy link
Owner

Orphis commented Jun 1, 2019

Dynamic libraries can cause a lot of issues. Why isn't it acceptable for you to link against the static version?

@Char-Aznable
Copy link
Author

Huge project, complicated dependency, not an option

@Orphis
Copy link
Owner

Orphis commented Jun 1, 2019

It shouldn't be complicated to fix it to accept static libraries there though if you really want to use those build scripts.

But if you insist on going with the dynamic libraries route, it's very unlikely to be ever supported here and you should probably use the official Boost distribution instead and maybe try their own new CMake build files.

@Char-Aznable
Copy link
Author

No, it's rather labor intensive. The Boost.Test entry point is different for dynamic vs static lib, which means that I have manually change thousands of lines of code written by different people with tons of macros all over the place.

Just curious, what is the trouble for supported dynamic lib?

@Orphis
Copy link
Owner

Orphis commented Jun 1, 2019

It can be automated with CMake and some other tooling too.
Supporting dynamic builds means I'd have to double the test coverage and add it for each library.

In general, there are issues with using shared libraries on all platforms, so it's always safer to use static builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants