CMake Error at /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake:17 (find_dependency)

在尝试使用GTSAM进行SLAM开发时,遇到CMake配置错误,解决方法是在/usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake文件中将find_dependency替换为find_package。参考链接提供了解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

slam第11讲使用gtsam时遇到的问题

CMake Error at /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake:17 (find_dependency):
  Unknown CMake command "find_dependency".
Call Stack (most recent call first):
  CMakeLists.txt:25 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/xx/Desktop/slambook/ch11/build/CMakeFiles/CMakeOutput.log".
Makefile:220: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1

解决方法:

gedit /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake

将第17行的find_dependency 改为find_package

参考:
https://blog.youkuaiyun.com/weixin_45617478/article/details/104113617

/usr/local/clion-2025.1.2/bin/cmake/linux/x64/bin/cmake --build /home/hdy/CLionProjects/untitled/cmake-build-release --target untitled -j 6 [2/2] Linking CXX executable untitled FAILED: untitled : && /usr/bin/c++ -O3 -DNDEBUG -Wl,--dependency-file=CMakeFiles/untitled.dir/link.d CMakeFiles/untitled.dir/main.cpp.o -o untitled -Wl,-rpath,/usr/local/lib:/usr/lib/x86_64-linux-gnu/openmpi/lib /usr/local/lib/libopencv_gapi.so.4.8.0 /usr/local/lib/libopencv_highgui.so.4.8.0 /usr/local/lib/libopencv_ml.so.4.8.0 /usr/local/lib/libopencv_objdetect.so.4.8.0 /usr/local/lib/libopencv_photo.so.4.8.0 /usr/local/lib/libopencv_stitching.so.4.8.0 /usr/local/lib/libopencv_video.so.4.8.0 /usr/local/lib/libopencv_videoio.so.4.8.0 -lfltk /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so -lsqlite3 -ldl -lpthread /usr/local/lib/libopencv_imgcodecs.so.4.8.0 /usr/local/lib/libopencv_dnn.so.4.8.0 /usr/local/lib/libopencv_calib3d.so.4.8.0 /usr/local/lib/libopencv_features2d.so.4.8.0 /usr/local/lib/libopencv_flann.so.4.8.0 /usr/local/lib/libopencv_imgproc.so.4.8.0 /usr/local/lib/libopencv_core.so.4.8.0 && : /usr/bin/ld: CMakeFiles/untitled.dir/main.cpp.o: in function `pngDisplay(Fl_Box*, Fl_Image*, char*)': main.cpp:(.text+0x27): undefined reference to `Fl_PNG_Image::Fl_PNG_Image(char const*)' /usr/bin/ld: CMakeFiles/untitled.dir/main.cpp.o: in function `main': main.cpp:(.text.startup+0x9): undefined reference to `fl_register_images()' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
最新发布
06-24
[0.148s] WARNING:colcon.colcon_core.package_identification:Failed to parse ROS package manifest in 'src/wheeltec_gps_path': Error(s) in package 'src/wheeltec_gps_path/package.xml': Error(s): - The generic dependency on 'tf2_geometry_msgs' is redundant with: build_depend, build_export_depend, exec_depend Starting >>> nmea_msgs Starting >>> wheeltec_gps_path --- stderr: wheeltec_gps_path Error parsing '/home/hang/gps_ws/src/wheeltec_gps_path/package.xml': Traceback (most recent call last): File "/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 143, in <module> main() File "/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 52, in main raise e File "/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 48, in main package = parse_package_string( File "/usr/lib/python3/dist-packages/catkin_pkg/package.py", line 786, in parse_package_string raise InvalidPackage('Error(s):%s' % (''.join(['\n- %s' % e for e in errors])), filename) catkin_pkg.package.InvalidPackage: Error(s) in package '/home/hang/gps_ws/src/wheeltec_gps_path/package.xml': Error(s): - The generic dependency on 'tf2_geometry_msgs' is redundant with: build_depend, build_export_depend, exec_depend CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:94 (message): execute_process(/usr/bin/python3 /opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py /home/hang/gps_ws/src/wheeltec_gps_path/package.xml /home/hang/gps_ws/build/wheeltec_gps_path/ament_cmake_core/package.cmake) returned error code 1 Call Stack (most recent call first): /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml) /opt/ros/foxy/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml) CMakeLists.txt:38 (ament_lint_auto_find_test_dependencies)
05-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值