Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ament_export_dependencies(Boost) not working?

I'm trying to use a library that depends on boost, and it doesn't seem like boost is properly being pulled in as a recursive dependency. How do I properly export the dependency on boost for downstream packages?

My build fails with:

/usr/bin/ld: CMakeFiles/slam_karto.dir/src/slam_karto.cpp.o: undefined reference to symbol '_ZN5boost6detail23get_current_thread_dataEv'
//usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [slam_karto] Error 1
make[1]: *** [CMakeFiles/slam_karto.dir/all] Error 2
make: *** [all] Error 2
---
Failed   <<< slam_karto [ Exited with code 2 ]

From my library CMake:

cmake_minimum_required(VERSION 3.5)
project(open_karto)
find_package(Boost REQUIRED COMPONENTS thread)
include_directories(include)
add_library(karto SHARED src/Karto.cpp src/Mapper.cpp)
ament_target_dependencies(karto Boost)
ament_export_include_directories(include)
ament_export_libraries(karto)
ament_export_dependencies(Boost)

From the consuming package CMakeLists.txt:

ament_target_dependencies(slam_karto
  open_karto
  )

I can make the error go away by changing the consuming package to have the following, but this is very bad practice:

find_package(Boost REQUIRED COMPONENTS thread)
ament_target_dependencies(slam_karto
  open_karto
  Boost
  )