I was trying to build the ROS examples and got stuck at this:
[ 66%] Linking CXX executable ../RGBD
[ 77%] Linking CXX executable ../Mono
/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:215: 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....
[ 77%] Built target Mono
[ 88%] Linking CXX executable ../MonoAR
[ 88%] Built target MonoAR
[100%] Linking CXX executable ../Stereo
/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:215: 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
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
andre@andre:~/ORB_SLAM2$ ./build_ros.sh
What could that be?
You need add a line in the CMakeList.txt in Examples/ROS/ORB_SLAM2, the compiler not found the boost library code so it can't links it, you need to add the line "-lboost_system" in the section of libraries. When you end to edit the file must be like this:
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
-lboost_system
)
Ok, that worked fine! Thank you for the help =)
CMakeFiles/rgbd_tum.dir/Examples/RGB-D/rgbd_tum.cc.o:(.data.rel+0x0): undefined reference to
vtable for pangolin::HandlerScroll' CMakeFiles/rgbd_tum.dir/Examples/RGB-D/rgbd_tum.cc.o:(.data.rel+0x8): undefined reference tovtable for pangolin::Handler'
../lib/libORB_SLAM2.so: undefined reference toglClearColor' ../lib/libORB_SLAM2.so: undefined reference toglColor3f'
../lib/libORB_SLAM2.so: undefined reference toglMultMatrixd' ../lib/libORB_SLAM2.so: undefined reference topangolin::CreateWindowAndBind(std::__cxx11::basic_string, std::allocator >, int, int, pangolin::Params const&)'
../lib/libORB_SLAM2.so: undefined reference toglClear' ../lib/libORB_SLAM2.so: undefined reference toglEnable'
../lib/libORB_SLAM2.so: undefined reference topangolin::CreatePanel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../lib/libORB_SLAM2.so: undefined reference topangolin::BindToContext(std::__cxx11::basic_string, std::allocator >)'
../lib/libORB_SLAM2.so: undefined reference topangolin::VarState::I()' ../lib/libORB_SLAM2.so: undefined reference toglEnd'
../lib/libORB_SLAM2.so: undefined reference topangolin::FinishFrame()' ../lib/libORB_SLAM2.so: undefined reference topangolin::OpenGlRenderState::Follow(pangolin::OpenGlMatrix const&, bool)'
../lib/libORB_SLAM2.so: undefined reference toglBegin' ../lib/libORB_SLAM2.so: undefined reference toglPopMatrix'
../lib/libORB_SLAM2.so: undefined reference topangolin::CreateDisplay()' ../lib/libORB_SLAM2.so: undefined reference topangolin::ProjectionMatrix(int, int, double, double, double, double, double, double)'
../lib/libORB_SLAM2.so: undefined reference toglBlendFunc' ../lib/libORB_SLAM2.so: undefined reference topangolin::View::SetHandler(pangolin::Handler)'
../lib/libORB_SLAM2.so: undefined reference topangolin::Handler3D::Handler3D(pangolin::OpenGlRenderState&, pangolin::AxisDirection, float, float)' ../lib/libORB_SLAM2.so: undefined reference topangolin::OpenGlRenderState::SetModelViewMatrix(pangolin::OpenGlMatrix)'
../lib/libORB_SLAM2.so: undefined reference toglVertex3f' ../lib/libORB_SLAM2.so: undefined reference toglLineWidth'
../lib/libORB_SLAM2.so: undefined reference topangolin::Split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char)' ../lib/libORB_SLAM2.so: undefined reference toglPointSize'
../lib/libORB_SLAM2.so: undefined reference topangolin::ModelViewLookAt(double, double, double, double, double, double, double, double, double)' ../lib/libORB_SLAM2.so: undefined reference topangolin::OpenGlRenderState::OpenGlRenderState(pangolin::OpenGlMatrix const&, pangolin::OpenGlMatrix const&)'
../lib/libORB_SLAM2.so: undefined reference topangolin::View::SetBounds(pangolin::Attach, pangolin::Attach, pangolin::Attach, pangolin::Attach, double)' ../lib/libORB_SLAM2.so: undefined reference toglMultMatrixf'
../lib/libORB_SLAM2.so: undefined reference topangolin::OpenGlMatrix::SetIdentity()' ../lib/libORB_SLAM2.so: undefined reference toglPushMatrix'
../lib/libORB_SLAM2.so: undefined reference topangolin::View::SetBounds(pangolin::Attach, pangolin::Attach, pangolin::Attach, pangolin::Attach)' ../lib/libORB_SLAM2.so: undefined reference topangolin::View::Activate(pangolin::OpenGlRenderState const&) const'
../lib/libORB_SLAM2.so: undefined reference to `glColor4f'
collect2: error: ld returned 1 exit status
CMakeFiles/rgbd_tum.dir/build.make:127: recipe for target '../Examples/RGB-D/rgbd_tum' failed
make[2]: [../Examples/RGB-D/rgbd_tum] Error 1
CMakeFiles/Makefile2:257: recipe for target 'CMakeFiles/rgbd_tum.dir/all' failed
make[1]: * [CMakeFiles/rgbd_tum.dir/all] Error 2
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
-lboost_system
)
After adding the line in the CMakeList.txt in Examples/ROS/ORB_SLAM2, the error still exists, could someone tell me how to fix it?
@Andreluizfc @raulmur could you please help me out or give me a direction?
Most helpful comment
You need add a line in the CMakeList.txt in Examples/ROS/ORB_SLAM2, the compiler not found the boost library code so it can't links it, you need to add the line "-lboost_system" in the section of libraries. When you end to edit the file must be like this:
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
-lboost_system
)