LORD-MicroStrain / microstrain_inertial

ROS driver for all of MicroStrain's current G and C series products. To learn more visit
https://www.microstrain.com/inertial
97 stars 72 forks source link

undefined reference to `boost::system::detail::generic_category_instance' building with C++17 #156

Closed lucasw closed 2 years ago

lucasw commented 2 years ago

Describe the bug

I think this is because mscl isn't built with C++17 (so this issue could ultimately belong to the mscl repo)

2022-05-22T15:14:13.2117432Z microstrain_inertial_driver_node.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x44): undefined reference to `boost::system::detail::generic_category_instance'
2022-05-22T15:14:13.2118740Z /usr/bin/ld: microstrain_inertial_driver_node.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x63): undefined reference to `boost::system::detail::generic_category_instance'
...

I need to build with C++17 to avoid a log4cxx 0.12 issue while building in Ubuntu 22.04, but the issue can be demonstrated in 20.04 also.

To Reproduce Steps to reproduce the behavior:

20.04 instructions:

Use https://github.com/lucasw/microstrain_inertial/tree/cpp17


22.04 instructions (added before figuring out the same issue exists in 20.04

I'm building this on Ubuntu 22.04 which has boost 1.74 and g++ 11.2.0

I've removed dependenices on diagnostic_updater and roslint in https://github.com/lucasw/microstrain_inertial/tree/ubuntu2204_minimal

I also have to use C++17 to compile to avoid a log4cxx 0.12 issue (I'll see if it builds fine on 20.04 with that change also, but possibly this is a component to the issue if mscl doesn't like C++17 here)

Basic ros packages can be installed in 22.04 with apt (no ppa necessary, I may be missing a few other packages here):

sudo apt install ros-* catkin

These repos are needed to be checked out in source to satisfy dependencies because they aren't available via apt:

repositories:
  geographic_info:
    type: git
    url: git@github.com:ros-geographic-info/geographic_info.git
    version: master
  mavros:
    type: git
    url: git@github.com:mavlink/mavros.git
    version: master
  microstrain_inertial:
    type: git
    url: git@github.com:lucasw/microstrain_inertial
    version: ubuntu2204_minimal
  nmea_msgs:
    type: git
    url: git@github.com:ros-drivers/nmea_msgs
    version: master
  unique_identifier:
    type: git
    url: git@github.com:ros-geographic-info/unique_identifier.git
    version: master

these CATKIN_IGNOREs are used to further reduce dependencies:

./mavros/mavros/CATKIN_IGNORE
./mavros/test_mavros/CATKIN_IGNORE
./mavros/libmavconn/CATKIN_IGNORE
./mavros/mavros_extras/CATKIN_IGNORE
./microstrain_inertial/microstrain_inertial_rqt/CATKIN_IGNORE

Finally build with catkin_make (same issue occurs with catkin build but catkin_tools has to be installed from source)

ROS_VERSION=1 catkin_make

I can put all of the above into a Dockerfile if there's interest but you don't have 22.04 conveniently available.

Expected behavior

The microstrain driver builds to completion

Environment (please complete the following information):

Modifications Did you modify the source code in any way while testing? If so, please note those modifications here.

Yes as mentioned above: https://github.com/lucasw/microstrain_inertial/tree/cpp17

Launch Parameters If you have an updated params.yml file, please attach it to this issue.

Additional context Add any other context about the problem here.

robbiefish commented 2 years ago

I think this is related to this issue and indeed appears to be a problem with MSCL, more specifically, the version of C++ that the boost version MSCL uses is compiled with.

At the moment, I don't see an easy way to fix this for all users as it would require us to update our CI to use a different version of boost and would likely also result in us having to bump the C++ version we build MSCL with. We are in the process of reworking the build system for MSCL, so that should be easier to do in the future.

In the mean time, this driver does allow you to specify a custom path to MSCL by specifying -DMSCL_DIR=/path/to/mscl so if you wanted to build a version of boost with C++14 or above, or if you had one already installed, you could try rebuilding MSCL with that version of boost, and then specify it's location with the MSCL_DIR

lucasw commented 2 years ago

It wasn't clear to me how to build MSCL separate but I didn't spend a lot of time looking at it. I'm ok waiting for an improved MSCL build system- or I'll try that branch out in the current state.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 2 weeks with no activity. If the issue is still not resolved, please leave a comment describing what is still not working

lucasw commented 2 years ago

I tried out https://github.com/LORD-MicroStrain/MSCL/pull/241 and made some modifications to microstrain_inertial_driver with MSCL as a sub-submodule to build with it on 22.04, the build works though I haven't yet tried connecting it to real hardware:

https://github.com/lucasw/microstrain_inertial/tree/cmake_mscl https://github.com/lucasw/microstrain_inertial_driver_common/tree/mscl_cmake https://github.com/lucasw/MSCL/tree/cmake_mscl_2204

I also modified the MSCL build to put the Output dir in the cmake binary dir instead of source dir.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 2 weeks with no activity. If the issue is still not resolved, please leave a comment describing what is still not working

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 2 weeks since being marked as stale. If the issue is still not resolved, please reopen the issue, and leave a comment describing what is still not working