orbbec / OrbbecSDK_ROS1

OrbbecSDK ROS wrapper
Apache License 2.0
50 stars 30 forks source link

catkin_make时报错boost::filesystem::detail::creat_directory(boost::filesystem::path const&,boost::filesystem::path const*,boost::system::error_code*)未定义的引用 #1

Closed lyc233333 closed 1 year ago

lyc233333 commented 1 year ago

出错时的log如下,系统为Ubuntu18.04,jetson nano开发板

Base path: /home/slam/ros_ws Source space: /home/slam/ros_ws/src Build space: /home/slam/ros_ws/build Devel space: /home/slam/ros_ws/devel Install space: /home/slam/ros_ws/install Creating symlink “/home/slam/ros_ws/src/CMakeLists.txt” pointing to “/opt/ros/melodic/share/catkin/cmake/toplevel.cmake”

Running command: “cmake /home/slam/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/slam/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/slam/ros_ws/install -G Unix Makefiles” in “/home/slam/ros_ws/build” – The C compiler identification is GNU 11.1.0 – The CXX compiler identification is GNU 11.1.0 – Check for working C compiler: /usr/bin/cc – Check for working C compiler: /usr/bin/cc – works – Detecting C compiler ABI info – Detecting C compiler ABI info - done – Detecting C compile features – Detecting C compile features - done – Check for working CXX compiler: /usr/bin/c++ – Check for working CXX compiler: /usr/bin/c++ – works – Detecting CXX compiler ABI info – Detecting CXX compiler ABI info - done – Detecting CXX compile features – Detecting CXX compile features - done – Using CATKIN_DEVEL_PREFIX: /home/slam/ros_ws/devel – Using CMAKE_PREFIX_PATH: /opt/ros/melodic – This workspace overlays: /opt/ros/melodic – Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.17”, minimum required is “2”) – Using PYTHON_EXECUTABLE: /usr/bin/python2 – Using Debian Python package layout – Using empy: /usr/bin/empy – Using CATKIN_ENABLE_TESTING: ON – Call enable_testing() – Using CATKIN_TEST_RESULTS_DIR: /home/slam/ros_ws/build/test_results – Found gtest sources under ‘/usr/src/googletest’: gtests will be built – Found gmock sources under ‘/usr/src/googletest’: gmock will be built – Found PythonInterp: /usr/bin/python2 (found version “2.7.17”) – Looking for pthread.h – Looking for pthread.h - found – Looking for pthread_create – Looking for pthread_create - not found – Looking for pthread_create in pthreads – Looking for pthread_create in pthreads - not found – Looking for pthread_create in pthread – Looking for pthread_create in pthread - found – Found Threads: TRUE – Using Python nosetests: /usr/bin/nosetests-2.7 – catkin 0.7.29 – BUILD_SHARED_LIBS is on – BUILD_SHARED_LIBS is on – ~~~~~~~~~~~~~ – ~~ traversing 1 packages in topological order: – ~~ - orbbec_camera – ~~~~~~~~~~~~~ – +++ processing catkin package: ‘orbbec_camera’ – ==> add_subdirectory(OrbbecSDK_ROS1) – Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy – Found OpenCV: /usr (found version “4.1.1”) – Boost found. – Found PkgConfig: /usr/bin/pkg-config (found version “0.29.1”) – Checking for one of the modules ‘libglog’ – ORRBEC Machine : aarch64

– ORRBEC Machine Bits : 64

– orbbec_camera: 3 messages, 9 services – Configuring done – Generating done – Build files have been written to: /home/slam/ros_ws/build

[100%] Linking CXX executable /home/slam/ros_ws/devel/lib/orbbec_camera/orbbec_camera_node /home/slam/ros_ws/devel/lib/liborbbec_camera.so:对‘boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::filesystem::path const, boost::system::error_code)’未定义的引用 collect2: error: ld returned 1 exit status OrbbecSDK_ROS1/CMakeFiles/orbbec_camera_node.dir/build.make:187: recipe for target ‘/home/slam/ros_ws/devel/lib/orbbec_camera/orbbec_camera_node’ failed make[2]: [/home/slam/ros_ws/devel/lib/orbbec_camera/orbbec_camera_node] Error 1 CMakeFiles/Makefile2:800: recipe for target ‘OrbbecSDK_ROS1/CMakeFiles/orbbec_camera_node.dir/all’ failed make[1]: [OrbbecSDK_ROS1/CMakeFiles/orbbec_camera_node.dir/all] Error 2 Makefile:140: recipe for target ‘all’ failed make: *** [all] Error 2 Invoking “make -j4 -l4” failed

尝试以下解决方式均无效: 1.使用不同版本的boost(1.65/1.82) 2.使用不同版本gcc(7/11)

lyc233333 commented 1 year ago

已解决,解决方法为:

报错的代码位置为orbbedsdk_ros文件夹里src里ob_camera_node.cpp中有三处使用boost::filesystem:create_directory创建目录,把这三处改为使用c的其他创建目录的函数即可(我在ubuntu中替换为linux系统可用的mkdir -p),注意使用的c版本以及系统,一些新的函数比如std::filesystem在c++17中才能使用