小问题比较多,根据自己编译的情况罗列,不一定是最佳解决办法。
-------------------------------------------------------------------------
CMake Error at /usr/share/cmake-3.16/Modules/FindQt4.cmake:1314 (message): ? Found unsuitable Qt version "5.12.8" from /usr/bin/qmake, this code ? requires Qt 4.x Call Stack (most recent call first): ? lidar/hector_slam/hector_geotiff/CMakeLists.txt:12 (find_package)
NOT working sudo add-apt-repository ppa:rock-core/qt4 sudo add-apt-repository --remove ppa:rock-core/qt4
网上有个说法,修改 src/lidar/hector_slam/hector_geotiff/CMakeLists.txt,把
find_package(Qt4 4.6 COMPONENTS QtCore QtGui REQUIRED)
改为
find_package(Qt5 COMPONENTS Core Gui REQUIRED) 我试了一上,出现下面两个问题
--------------------------------------------------------------------- ubuntu@ubuntu:/opt$ whereis qmake qmake: /usr/bin/qmake ubuntu@ubuntu:/opt$ whereis qt5 qt5: /usr/lib/aarch64-linux-gnu/qt5 /usr/lib/qt5 /usr/share/qt5
CMake Error at lidar/hector_slam/hector_geotiff/CMakeLists.txt:28 (include): ? include called with wrong number of arguments.? include() only takes one ? file.
CMake Warning at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:166 (message): ? catkin_package() DEPENDS on 'QT' but neither 'QT_INCLUDE_DIRS' nor ? 'QT_LIBRARIES' is defined. Call Stack (most recent call first): ? /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package) ? lidar/hector_slam/hector_geotiff/CMakeLists.txt:69 (catkin_package)
--------------------------------------------------------------------------- CMake Error at lidar/hector_slam/hector_geotiff/CMakeLists.txt:29 (include): ? include called with wrong number of arguments.? include() only takes one ? file.
CMake Warning at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:166 (message): ? catkin_package() DEPENDS on 'QT' but neither 'QT_INCLUDE_DIRS' nor 'QT_LIBRARIES' is defined.
最终发现,hector_slam的版本不对,换个版本能解决这个问题
解决办法,
下载对应的版本并重新编译
-------------------------------------------------------------------------------
CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package): ? Could not find a package configuration file provided by "boost_signals" ? (requested version 1.71.0) with any of the following names:
??? boost_signalsConfig.cmake ??? boost_signals-config.cmake
? Add the installation prefix of "boost_signals" to CMAKE_PREFIX_PATH or set ? "boost_signals_DIR" to a directory containing one of the above files.? If ? "boost_signals" provides a separate development package or SDK, be sure it ? has been installed. Call Stack (most recent call first): ? /usr/lib/aarch64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component) ? /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package) ? imu_filter_madgwick/CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred! See also "/home/ubuntu/riki/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/ubuntu/riki/catkin_ws/build/CMakeFiles/CMakeError.log".
这个问题十分奇怪,我是尝试着解决的,办法如下,
sudo apt autoremove
sudo apt update
sudo apt upgrade
后来还重新安装了一次ros-noetic才解决。具体原因可能是文件包冲突。
----------------------------------------------------------------------------------
[ 34%] Building CXX object opencv_apps/CMakeFiles/phase_corr_exe.dir/phase_corr.cpp.o In file included from /usr/include/string.h:495, ???????????????? from ../Include/Linux-Arm/../Linux-x86/XnPlatformLinux-x86.h:34, ???????????????? from ../Include/Linux-Arm/XnPlatformLinux-Arm.h:25, ???????????????? from ../Include/XnPlatform.h:55, ???????????????? from ../Include/XnOS.h:27, ???????????????? from ../Include/XnProfiling.h:27, ???????????????? from XnProfiling.cpp:24: In function ‘char* strncpy(char*, const char*, size_t)’, ??? inlined from ‘XnStatus xnProfilingSectionStart(const char*, XnBool, XnProfilingHandle*)’ at XnProfiling.cpp:220:11: /usr/include/aarch64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 256 equals destination size [-Wstringop-truncation] ? 106 |?? return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); ????? |????????? ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ 34%] Linking CXX executable /home/ubuntu/riki/catkin_ws/devel/lib/opencv_apps/face_recognition [ 34%] Built target face_recognition_exe Scanning dependencies of target watershed_segmentation_exe [ 34%] Building CXX object opencv_apps/CMakeFiles/watershed_segmentation_exe.dir/watershed_segmentation.cpp.o Linux/XnLinuxUSB.cpp:40:10: fatal error: libudev.h: No such file or directory ?? 40 | #include <libudev.h> ????? |????????? ^~~~~~~~~~~ compilation terminated.
解决办法, sudo apt-get install libudev-dev
------------------------------------------------------------------------ In file included from /home/ubuntu/riki/catkin_ws/src/clbrobot_project/clbrobot/src/riki_base.cpp:4: /home/ubuntu/riki/catkin_ws/src/clbrobot_project/clbrobot/include/riki_base.h:5:10: fatal error: riki_msgs/Velocities.h: No such file or directory ??? 5 | #include <riki_msgs/Velocities.h> ????? |????????? ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [clbrobot_project/clbrobot/CMakeFiles/riki_base.dir/build.make:63: clbrobot_project/clbrobot/CMakeFiles/riki_base.dir/src/riki_base.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:15585: clbrobot_project/clbrobot/CMakeFiles/riki_base.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
解决办法,
catkin_make -DCATKIN_WHITELIST_PACKAGES="riki_msgs" catkin_make -DCATKIN_WHITELIST_PACKAGES=""
-------------------------------------------------------------------------- In file included from /home/ubuntu/riki/catkin_ws/src/clbrobot_project/frontier_exploration/polygon_layer/src/polygon_layer.cpp:1: /home/ubuntu/riki/catkin_ws/src/clbrobot_project/frontier_exploration/polygon_layer/include/polygon_layer/polygon_layer.h:9:10: fatal error: exploration_msgs/SetPolygon.h: No such file or directory ??? 9 | #include <exploration_msgs/SetPolygon.h> ????? |????????? ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [clbrobot_project/frontier_exploration/polygon_layer/CMakeFiles/polygon_layer.dir/build.make:63: clbrobot_project/frontier_exploration/polygon_layer/CMakeFiles/polygon_layer.dir/src/polygon_layer.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:20435: clbrobot_project/frontier_exploration/polygon_layer/CMakeFiles/polygon_layer.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
解决办法, catkin_make -DCATKIN_WHITELIST_PACKAGES="exploration_msgs" catkin_make -DCATKIN_WHITELIST_PACKAGES=""
------------------------------------------- /usr/bin/ld: CMakeFiles/apply_calib.dir/src/apply_calib.cpp.o: in function `imu_calib::ApplyCalib::ApplyCalib()': apply_calib.cpp:(.text+0x50): undefined reference to `imu_calib::AccelCalib::AccelCalib()' /usr/bin/ld: apply_calib.cpp:(.text+0x1ec): undefined reference to `imu_calib::AccelCalib::loadCalib(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' /usr/bin/ld: apply_calib.cpp:(.text+0x208): undefined reference to `imu_calib::AccelCalib::calibReady()' /usr/bin/ld: CMakeFiles/apply_calib.dir/src/apply_calib.cpp.o: in function `imu_calib::ApplyCalib::rawImuCallback(boost::shared_ptr<riki_msgs::Imu_<std::allocator<void> > const>)': apply_calib.cpp:(.text+0xc54): undefined reference to `imu_calib::AccelCalib::applyCalib(double*, double*)' collect2: error: ld returned 1 exit status make[2]: *** [clbrobot_project/imu_calib/CMakeFiles/apply_calib.dir/build.make:117: /home/ubuntu/riki/catkin_ws/devel/lib/imu_calib/apply_calib] Error 1 make[1]: *** [CMakeFiles/Makefile2:7620: clbrobot_project/imu_calib/CMakeFiles/apply_calib.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 61%] Linking CXX executable /home/ubuntu/riki/catkin_ws/devel/lib/imu_calib/do_calib /usr/bin/ld: CMakeFiles/do_calib.dir/src/do_calib.cpp.o: in function `imu_calib::DoCalib::DoCalib()': do_calib.cpp:(.text+0x50): undefined reference to `imu_calib::AccelCalib::AccelCalib()' /usr/bin/ld: CMakeFiles/do_calib.dir/src/do_calib.cpp.o: in function `imu_calib::DoCalib::imuCallback(boost::shared_ptr<riki_msgs::Imu_<std::allocator<void> > const>)': do_calib.cpp:(.text+0x714): undefined reference to `imu_calib::AccelCalib::beginCalib(int, double)' /usr/bin/ld: do_calib.cpp:(.text+0x858): undefined reference to `imu_calib::AccelCalib::addMeasurement(imu_calib::AccelCalib::Orientation, double, double, double)' /usr/bin/ld: do_calib.cpp:(.text+0x8f8): undefined reference to `imu_calib::AccelCalib::computeCalib()' /usr/bin/ld: do_calib.cpp:(.text+0x964): undefined reference to `imu_calib::AccelCalib::saveCalib(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' collect2: error: ld returned 1 exit status make[2]: *** [clbrobot_project/imu_calib/CMakeFiles/do_calib.dir/build.make:117: /home/ubuntu/riki/catkin_ws/devel/lib/imu_calib/do_calib] Error 1 make[1]: *** [CMakeFiles/Makefile2:7677: clbrobot_project/imu_calib/CMakeFiles/do_calib.dir/all] Error 2 fatal: unable to access 'https://github.com/orbbec/OpenNI2.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated. CMake Error at /home/ubuntu/riki/catkin_ws/build/depth_camera/ros_astra_camera/astra_openni2/tmp/astra_openni2-gitupdate.cmake:55 (message): ? Failed to fetch repository 'https://github.com/orbbec/OpenNI2.git'
make[2]: *** [depth_camera/ros_astra_camera/CMakeFiles/astra_openni2.dir/build.make:96: depth_camera/ros_astra_camera/astra_openni2/src/astra_openni2-stamp/astra_openni2-update] Error 1 make[1]: *** [CMakeFiles/Makefile2:6461: depth_camera/ros_astra_camera/CMakeFiles/astra_openni2.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 Invoking "make -j4 -l4" failed
老问题,链接不正确,可能生成了空的链接文件,强制重新编译一下。
--------------------------------------------------------------- [ 84%] Generating EusLisp code from frontier_exploration/ExploreTaskFeedback.msg /bin/sh: 1: python2.7: not found /bin/sh: 1: python2.7: not found /bin/sh: 1: python2.7: not found /bin/sh: 1: python2.7: not found make[3]: Packaging/Harvest.py: Command not found make[3]: *** [Makefile:205: release] Error 127 make[2]: *** [depth_camera/ros_astra_camera/CMakeFiles/astra_openni2.dir/build.make:112: depth_camera/ros_astra_camera/astra_openni2/src/astra_openni2-stamp/astra_openni2-build] Error 2 make[1]: *** [CMakeFiles/Makefile2:6461: depth_camera/ros_astra_camera/CMakeFiles/astra_openni2.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 84%] Generating EusLisp manifest code for frontier_exploration [ 84%] Built target frontier_exploration_generate_messages_eus [ 84%] Linking CXX executable /home/ubuntu/riki/catkin_ws/devel/lib/exploration_server/plugin_client [ 84%] Built target plugin_client [ 84%] Linking CXX executable /home/ubuntu/riki/catkin_ws/devel/lib/exploration_server/exploration_server_node [ 84%] Built target exploration_server_node make: *** [Makefile:141: all] Error 2 Invoking "make -j4 -l4" failed
解决办法,
Step 1: Update system:
sudo apt-get update
Step 2: Install: python2.7-minimal
Ater updaing the OS run following command to install the packae:
sudo apt-get install python2.7-minimal
参考:
Install python2.7-minimal on Ubuntu: sudo apt-get install python2.7-minimal
-------------------------------------------------------------------- Scanning dependencies of target depthimage_to_laserscan [ 85%] Building CXX object depth_camera/depthimage_to_laserscan/CMakeFiles/depthimage_to_laserscan.dir/src/depthimage_to_laserscan.cpp.o /home/ubuntu/riki/catkin_ws/src/clbrobot_project/riki_line_follower/src/linedetect.cpp: In member function ‘int LineDetect::colorthresh(cv::Mat)’: /home/ubuntu/riki/catkin_ws/src/clbrobot_project/riki_line_follower/src/linedetect.cpp:96:5: error: ‘CV_FONT_HERSHEY_COMPLEX’ was not declared in this scope ?? 96 |???? CV_FONT_HERSHEY_COMPLEX, 1, CV_RGB(255, 0, 0)); ????? |???? ^~~~~~~~~~~~~~~~~~~~~~~ [ 85%] Linking CXX shared library /home/ubuntu/riki/catkin_ws/devel/lib/libDepthImageToLaserScanNodelet.so [ 85%] Built target DepthImageToLaserScanNodelet Scanning dependencies of target riki_lidar_follower_generate_messages [ 85%] Built target riki_lidar_follower_generate_messages Scanning dependencies of target opencv_apps [ 85%] Linking CXX executable /home/ubuntu/riki/catkin_ws/devel/lib/depthimage_to_laserscan/depthimage_to_laserscan [ 85%] Building CXX object opencv_apps/CMakeFiles/opencv_apps.dir/src/nodelet/nodelet.cpp.o [ 85%] Built target depthimage_to_laserscan [ 86%] Building CXX object opencv_apps/CMakeFiles/opencv_apps.dir/src/nodelet/adding_images_nodelet.cpp.o make[2]: *** [clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/build.make:76: clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/src/linedetect.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:5178: clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 86%] Building CXX object opencv_apps/CMakeFiles/opencv_apps.dir/src/nodelet/discrete_fourier_transform_nodelet.cpp.o [ 86%] Building CXX object opencv_apps/CMakeFiles/opencv_apps.dir/src/nodelet/pyramids_nodelet.cpp.o
原因, 这个是 opencv4的问题
以前系统的路径是
/usr/include/opecv2/**
到opencv4以后,系统默认的路径变成了
/usr/include/opencv4/opecv2/**
默认安装的是opencv4,采用cmake编译的时候,cmake一般也能找到opencv4;编译时候报错:
fatal error: opencv2/opencv.hpp: No such file or directory #include <opencv2/opencv.hpp>
解决方案,
这是因为opencv头文件的路径中多了一个opencv4的文件夹:/usr/include/opencv4/opencv2,
我的办法:将opencv2文件夹链接到include文件夹下 ??? sudo ln -s /usr/include/opencv4/opencv2? /usr/include/
将/usr/include/opencv4添加系统路径中去也应该可以解决这个问题。
------------------------------------------------------------------------------------------------------- /home/ubuntu/riki/catkin_ws/src/opencv_apps/src/nodelet/discrete_fourier_transform_nodelet.cpp:61:24: error: ‘DiscreteFourierTransformConfig’ in namespace ‘opencv_apps’ does not name a type; did you mean ‘DiscreteFourierTransformNodelet’? ?? 61 |?? typedef opencv_apps::DiscreteFourierTransformConfig Config; ????? |??????????????????????? ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ????? |??????????????????????? DiscreteFourierTransformNodelet /home/ubuntu/riki/catkin_ws/src/opencv_apps/src/nodelet/discrete_fourier_transform_nodelet.cpp:62:39: error: ‘Config’ was not declared in this scope; did you mean ‘dynamic_reconfigure::Config’? ?? 62 |?? typedef dynamic_reconfigure::Server<Config> ReconfigureServer; ????? |?????????????????????????????????????? ^~~~~~ ????? |?????????????????????????????????????? dynamic_reconfigure::Config
?
解决办法,
到下面的地址,
https://github.com/ros-perception/opencv_apps
根据你自己的系统,选择合适版本的opencv_apps,比如我在树莓派上装的ubuntu20.04.4 focal系统,就选这个 opencv_apps-release-debian-ros-noetic-opencv-apps_2.0.2-1_focal
------------------------------------------------------------------------------------------------------- /home/ubuntu/riki/catkin_ws/src/clbrobot_project/riki_line_follower/src/linedetect.cpp: In member function ‘int LineDetect::colorthresh(cv::Mat)’: /home/ubuntu/riki/catkin_ws/src/clbrobot_project/riki_line_follower/src/linedetect.cpp:96:5: error: ‘CV_FONT_HERSHEY_COMPLEX’ was not declared in this scope ?? 96 |???? CV_FONT_HERSHEY_COMPLEX, 1, CV_RGB(255, 0, 0)); ????? |???? ^~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/build.make:76: clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/src/linedetect.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:5178: clbrobot_project/riki_line_follower/CMakeFiles/detect.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
原因:
不知道为什么,#include <opencv2/opencv.hpp>不再包含imgproc_c.h中的内容,
解决办法:在linedetect.cpp中添加头文件
#include <opencv2/imgproc/imgproc_c.h>
|