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

building gadgetron on VM with boost 1.68 causes undefined reference to `boost::system::detail::generic_category_instance' #161

Closed
evgueni-ovtchinnikov opened this issue Dec 7, 2018 · 5 comments · Fixed by #429
Milestone

Comments

@evgueni-ovtchinnikov
Copy link
Contributor

Building Gadgetron needs gcc6 and boost 1.65.0 We tried with 1.68.0, but then got

undefined reference to `boost::system::detail::generic_category_instance'

This might be related to boostorg/system#26 as g++-6 defaults to C++-14 and therefore resolved by making sure that boost is built with gcc-6. This is actually #14.

@KrisThielemans
Copy link
Member

@evgueni-ovtchinnikov please try again with the new versiono fthe Superbuild. It works for me.

@evgueni-ovtchinnikov
Copy link
Contributor Author

update_VM.sh runs gcc-5.4.0

linking executable test_ismrmrd failed with error messages

undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'

had to use the same trick of setting (after failed update) USE_SYSTEM_ISMRMRD=ON to build

@KrisThielemans
Copy link
Member

Confirmed that this also happens with gcc 5.4 and older Gadgetron, e.g. gadgetron/gadgetron@e7eb430

It disappears when editing gadgetron's CMakeLists.txt to force use std=c++11 and not 14 (although this gives some warnings)

It seems therefore that we cannot use a packaged system boost 1.68, and that we'd have to build Boost ourselves, making sure that c++-14 is used.

sigh.

@KrisThielemans KrisThielemans changed the title building recent gadgetron on VM causes undefined reference to `boost::system::detail::generic_category_instance' building gadgetron on VM with boost 1.68 causes undefined reference to `boost::system::detail::generic_category_instance' Dec 17, 2018
@KrisThielemans
Copy link
Member

Lengthy discussion at https://groups.google.com/forum/#!topic/boost-developers-archive/EWG5NVOZo_g Conclusion is that you need to build boost (or any C++ library) with the same C++ standard version as you own code.

This seems to imply that we need to figure out what compiler options Gadgetron used, and then always build boost ourselves, using e.g. cxxstd=14.

Note that boost.system is header-only from 1.69, which might help a bit (but could still throw up problems for other boost libraries)

@KrisThielemans
Copy link
Member

Current Gadgetron master attempts to use C++ 20 (CMake will downgrade if it is not supported by the compiler)

@KrisThielemans KrisThielemans added this to the v2.1 milestone Feb 15, 2019
@KrisThielemans KrisThielemans modified the milestones: v2.1, v2.2 Oct 14, 2019
KrisThielemans added a commit to KrisThielemans/SIRF-SuperBuild that referenced this issue Jul 26, 2020
We get linking problems with boost system if the C++ versions
don't match (i.e. the one used to compile boost, and the current one),
specifically with boost::system::detail::generic_category_instance

Setting this variable forces Boost to use an inline variable, as opposed to
the instantiated variable in the library

Fixes SyneRBI#161
KrisThielemans added a commit to KrisThielemans/SIRF-SuperBuild that referenced this issue Jul 27, 2020
We get linking problems with boost system if the C++ versions
don't match (i.e. the one used to compile boost, and the current one),
specifically with boost::system::detail::generic_category_instance

Setting these preprocessor variables forces Boost to use inline variables, as opposed to
the instantiated variables in the library

Fixes SyneRBI#161
KrisThielemans added a commit that referenced this issue Jul 27, 2020
set preprocessor defines BOOST_ERROR_CODE_HEADER_ONLY and BOOST_SYSTEM_NO_DEPRECATED

Fixes #161
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

Successfully merging a pull request may close this issue.

2 participants