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

Build fails on Melodic / Ubuntu 18.04 due to StateEstimator linker error (fails to link Boost libraries) #88

Open
ChrisTimperley opened this issue Mar 27, 2020 · 2 comments
Assignees

Comments

@ChrisTimperley
Copy link

ChrisTimperley commented Mar 27, 2020

I was unable to build autorally on Melodic / Ubuntu 18.04 via catkin_make due to the following linker error when building the autorally_core package.

[ 92%] Linking CXX executable /ros_ws/devel/lib/autorally_core/StateEstimator
[ 93%] Built target param_getter
[ 94%] Built target pointgrey_camera_node
[ 95%] Built target PointGreyStereoCameraNodelet
[ 96%] Built target pointgrey_stereo_node
[ 97%] Built target pointgrey_list_cameras
[ 98%] Built target PointGreyCameraNodelet
/usr/bin/ld: cannot find -lBoost::system
/usr/bin/ld: cannot find -lBoost::serialization
/usr/bin/ld: cannot find -lBoost::system
/usr/bin/ld: cannot find -lBoost::filesystem
/usr/bin/ld: cannot find -lBoost::thread
/usr/bin/ld: cannot find -lBoost::date_time
/usr/bin/ld: cannot find -lBoost::regex
/usr/bin/ld: cannot find -lBoost::timer
/usr/bin/ld: cannot find -lBoost::chrono
collect2: error: ld returned 1 exit status
autorally/autorally_core/src/StateEstimator/CMakeFiles/StateEstimator.dir/build.make:140: recipe for target '/ros_ws/devel/lib/autorally_core/StateEstimator' failed
make[2]: *** [/ros_ws/devel/lib/autorally_core/StateEstimator] Error 1
CMakeFiles/Makefile2:7472: recipe for target 'autorally/autorally_core/src/StateEstimator/CMakeFiles/StateEstimator.dir/all' failed
make[1]: *** [autorally/autorally_core/src/StateEstimator/CMakeFiles/StateEstimator.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j16 -l16" failed

Boost is installed and otherwise working correctly. It seems, however, that the boost libraries are not explicitly linked against via target_link_libraries.

To fix the issue, I modified autorally_core/src/StateEstimator/CMakeLists.txt as follows:

@@ -1,4 +1,5 @@
-find_package(Boost REQUIRED)
+find_package(Boost REQUIRED
+  COMPONENTS chrono date_time filesystem regex serialization system thread timer)
 find_package(Eigen3 REQUIRED)
 find_package (GeographicLib REQUIRED)
 
@@ -12,7 +13,7 @@
   include_directories(${GTSAM_INCLUDE_DIR})
 
   add_executable(StateEstimator StateEstimator.cpp)
-  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} gtsam ${GeographicLib_LIBRARIES} ${TBB_LIBRARIES} ar_diagnostics)
+  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} gtsam ${Boost_LIBRARIES} ${GeographicLib_LIBRARIES} ${TBB_LIBRARIES} ar_diagnostics)
   add_dependencies(StateEstimator autorally_msgs_gencpp)
 
   install(TARGETS StateEstimator
@JasonGibson274
Copy link
Contributor

I'll make sure this gets address in cmake changes PR currently in progress.

@JasonGibson274 JasonGibson274 self-assigned this Jun 12, 2020
@tanmayd26
Copy link

tanmayd26 commented Aug 28, 2023

`CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:14 (add_executable):
Target "StateEstimator" links to target "TBB::tbb" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?

CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:14 (add_executable):
Target "StateEstimator" links to target "TBB::tbbmalloc" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?

`

I get this when I am doing catkin_make. I am using Ubuntu 20.04.

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

3 participants