ROS学习笔记(四):编译catkin时遇到的错误经历

参考资料:官方学习课件

遇到问题一:Invoking “cmake” failed

在执行catkin_make命令时:

# 在catkin工作空间下
$ catkin_make [make_targets] [-DCMAKE_VARIABLES=...]

出现如下问题:

-- Configuring incomplete, errors occurred!
See also "/home/li/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/li/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

参考这位同学的博客,使用命令行(很多博客都提到这种解法):

pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools

接着出现了新的问题(属于pip安装第三方库超时的问题):

    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

解决方案:(本菜再试了一次上面的命令就解决了)
1.延时处理:(小文件)

 pip --default-timeout=100 install -U pip
 pip --default-timeout=100 install 第三方库名

2.更换源:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 库名

3.离线下载安装

遇到问题二:Invoking “make cmake_check_build_system” failed

问题描述:

Base path: /home/li/catkin_ws
Source space: /home/li/catkin_ws/src
Build space: /home/li/catkin_ws/build
Devel space: /home/li/catkin_ws/devel
Install space: /home/li/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/li/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/li/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/li/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/li/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/li/catkin_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/python3 (found version "3.6.9") 
-- Using Python nosetests: /home/li/.local/bin/nosetests-2.7
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python3
  "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/melodic/share/catkin/cmake/../package.xml"
  "/home/li/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/melodic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml)
  /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/li/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/li/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

解决方法:
找了很久的解决方案,都不能解决问题。最后放弃使用python3用户需要执行的指令,反倒正常了:
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

最后的结果:

li@li-Lenovo:~/catkin_ws$ catkin_make
Base path: /home/li/catkin_ws
Source space: /home/li/catkin_ws/src
Build space: /home/li/catkin_ws/build
Devel space: /home/li/catkin_ws/devel
Install space: /home/li/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/li/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/li/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/li/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/li/catkin_ws/devel;/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/li/catkin_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") 
-- Using Python nosetests: /home/li/.local/bin/nosetests-2.7
-- catkin 0.7.26
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/li/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/li/catkin_ws/build"
####

猜你喜欢

转载自blog.csdn.net/qq_42910179/article/details/106881279