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
Undefined reference to symbol '_ZN5boost6system15system_categoryEv' #494
Comments
it's because the program can't find libboost_system.so and libboost_filesystem.so . Copy the two libs to ORB_SLAM2/lib , and then modify the CMakeLists.txt set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
++
${PROJECT_SOURCE_DIR}/../../../lib/libboost_filesystem.so
${PROJECT_SOURCE_DIR}/../../../lib/libboost_system.so and you can use locate boost_system boost_filesystem to find it |
I solved this problem adding this: set(LIBS -lboost_system |
Did you add all the above to the end of the CMakeLists.txt? Did you also do anything else? |
I only put -lboost_system inside set(LIBS...) Could show us the error? And your CMakeList.txt |
I get the following error: teun@teun-VirtualBox:~/ORB_SLAM2$ ./build_ros.sh I added -lboost_system to CMakeList.txt like this: target_link_libraries(${PROJECT_NAME} This is my whole CMakeList.txt: cmake_minimum_required(VERSION 2.8) IF(NOT CMAKE_BUILD_TYPE) MESSAGE("Build type: " ${CMAKE_BUILD_TYPE}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") include(CheckCXXCompilerFlag) LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules) find_package(OpenCV 3.0 QUIET) find_package(Eigen3 3.1.0 REQUIRED) include_directories( set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) add_library(${PROJECT_NAME} SHARED target_link_libraries(${PROJECT_NAME} set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/RGB-D) add_executable(rgbd_tum set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/Stereo) add_executable(stereo_kitti add_executable(stereo_euroc set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/Monocular) add_executable(mono_tum add_executable(mono_kitti add_executable(mono_euroc And added this to the end of the ~/.bashrc file |
Ok. In your first CmakeList.txt remove -lboost_system: target_link_libraries(${PROJECT_NAME} In your second CmakeList should put this flag in these parts: set(CMAKE_LIBRARY_OUTPUT_DIRECTORY Remove -lboost_system here: target_link_libraries(${PROJECT_NAME} set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(rgbd_tum set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(stereo_kitti add_executable(stereo_euroc set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(mono_tum add_executable(mono_kitti add_executable(mono_euroc I hope it works. |
I added the -lboost_system flags but continue to get the same error after changing my CMakeLists.txt file. cmake_minimum_required(VERSION 2.8) IF(NOT CMAKE_BUILD_TYPE) MESSAGE("Build type: " ${CMAKE_BUILD_TYPE}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") include(CheckCXXCompilerFlag) LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules) find_package(OpenCV 3.0 QUIET) find_package(Eigen3 3.1.0 REQUIRED) include_directories( set(CMAKE_LIBRARY_OUTPUT_DIRECTORY add_library(${PROJECT_NAME} SHARED target_link_libraries(${PROJECT_NAME} set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(rgbd_tum set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(stereo_kitti add_executable(stereo_euroc set(CMAKE_RUNTIME_OUTPUT_DIRECTORY add_executable(mono_tum add_executable(mono_kitti add_executable(mono_euroc |
Ok, I got confused. Remove all the flags in that CMakeList. I see that this CMakeList is the principal, you should do the changes in the ROS CMakeList. I think that is here: /home/teun/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeList.txt It should have this: set(LIBS |
It is working now. :) Thank you very much for the support! I really appreciate your help AldrichCabrera. |
@AldrichCabrera thank you |
@AldrichCabrera Thank you! |
@AldrichCabrera Thank you |
1 similar comment
@AldrichCabrera Thank you |
@AldrichCabrera I have followed your instructions, but it doesn't work for me. |
@AldrichCabrera Thank you!! |
Thanks you !! |
@AldrichCabrera Thank you! |
…15system_categoryEv' raulmur#494 (comment) Changes to be committed: modified: Examples/ROS/ORB_SLAM2/CMakeLists.txt new file: build_ros.sh
I Tried this but face some more error make[2]: *** No rule to make target '../../../../lib/libboost_filesystem.so', needed by '../Mono'. Stop. But below resolved set(LIBS |
Just adding -lboost_system to set(LIBS... directive in Examples/ROS/ORB_SLAM2/CMakeLists.txt worked for me! |
Thank you!! |
@AldrichCabrera, thank you so much! That really solved my problem :) 👍 |
think you very much! I have spent the whole day on this ! |
thx @AldrichCabrera , it help me a lot ! |
thx @AldrichCabrera ,it is very useful! |
Fixed! Thanks @AldrichCabrera. |
Just a note if you want to use the cmake module for boost to link the library, modifying the cmake file at Examples/ROS/ORB_SLAM2/CMakeList.txt as follows worked for me (modifications are in bold): find_package(Eigen3 3.1.0 REQUIRED) include_directories( set(LIBS |
Great! |
Thank You! 🔥❤️ |
remember to add -lboost_system under line 59 set(.....) such as set(LIBS |
change this file:/home/xxx/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txtcmake_minimum_required(VERSION 2.4.6) rosbuild_init() IF(NOT ROS_BUILD_TYPE) MESSAGE("Build type: " ${ROS_BUILD_TYPE}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") Check C++11 or C++0x supportinclude(CheckCXXCompilerFlag) LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake_modules) find_package(OpenCV 3.0 QUIET) find_package(Eigen3 3.1.0 REQUIRED) find_package(Boost COMPONENTS filesystem system REQUIRED)#加在其他find_package下面 include_directories( set(LIBS Node for monocular camerarosbuild_add_executable(Mono target_link_libraries(Mono Node for monocular camera (Augmented Reality Demo)rosbuild_add_executable(MonoAR target_link_libraries(MonoAR Node for stereo camerarosbuild_add_executable(Stereo target_link_libraries(Stereo Node for RGB-D camerarosbuild_add_executable(RGBD target_link_libraries(RGBD |
Hello, I have a problem with the new ROS libopencv_calib3d3.so.3.3.1 just now after an Ubuntu update, I solved this problem deleting the build and devel folder to then compile the new libs but now the problem is other when I try to compile the ORB_SLAM2 with ROS obtaining the next problems:
aldrich98@raldrich98:~/catkin_ws/src/ORB_SLAM2$ ./build_ros.sh
Building ROS nodes
mkdir: cannot create directory ‘build’: File exists
[rosbuild] Building package ORB_SLAM2
[rosbuild] using multiarch 'x86_64-linux-gnu' for finding Boost
[ 0%] Built target rospack_genmsg_libexe
[ 0%] Built target rosbuild_precompile
[ 12%] Built target Mono_INEGI
[ 18%] Linking CXX executable ../Stereo
[ 25%] Linking CXX executable ../RGBD
[ 37%] Built target Mono_Extractor
[ 50%] Built target Mono
[ 56%] Linking CXX executable ../RGBD_fake
[ 75%] Built target MonoAR
/usr/bin/ld: CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/RGBD.dir/build.make:217: recipe for target '../RGBD' failed
make[2]: *** [../RGBD] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/RGBD.dir/all' failed
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/Stereo.dir/build.make:217: recipe for target '../Stereo' failed
make[2]: *** [../Stereo] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
/usr/bin/ld: CMakeFiles/RGBD_fake.dir/src/ros_rgbd_fake.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/RGBD_fake.dir/build.make:243: recipe for target '../RGBD_fake' failed
make[2]: *** [../RGBD_fake] Error 1
CMakeFiles/Makefile2:733: recipe for target 'CMakeFiles/RGBD_fake.dir/all' failed
make[1]: *** [CMakeFiles/RGBD_fake.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered: