我已经更新了cmake,当我在catkin_ws中运行catkin_make时,即使sudo apt更新和sudo apt升级成功,cmake中也会出现错误。
cd ~/catkin_ws
catkin_make
以下错误显示为Cmake错误,cmake_check_build_system“失败。
Base path: /home/ubuntu/catkin_ws
Source space: /home/ubuntu/catkin_ws/src
Build space: /home/ubuntu/catkin_ws/build
Devel space: /home/ubuntu/catkin_ws/devel
Install space: /home/ubuntu/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/ubuntu/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ubuntu/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ubuntu/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- 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.8.10")
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
Traceback (most recent call last):
File "/home/ubuntu/catkin_ws/build/catkin_generated/generate_cached_setup.py", line 22, in <module>
code = generate_environment_script('/home/ubuntu/catkin_ws/devel/env.sh')
File "/opt/ros/noetic/lib/python3/dist-packages/catkin/environment_cache.py", line 63, in generate_environment_script
env_after = ast.literal_eval(output.decode('utf8'))
File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/lib/python3.8/ast.py", line 47, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 1
ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
^
SyntaxError: invalid syntax
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python3
"/home/ubuntu/catkin_ws/build/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/noetic/share/catkin/cmake/all.cmake:208 (safe_execute_process)
/opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/catkin_ws/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:3890: cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
我解决不了?怎么解决?
2条答案
按热度按时间vyswwuz21#
根据您的评论,您在工作区中混合了ROS版本。这在同一个工作区中是无效的。您可能有一个同时使用这两个版本的系统,但它们应该在不同的上下文中构建;也就是说,一个目录不应该同时包含这两个。还应该注意,catkin不是ROS 2的构建系统(colcon是)。
qyyhg6bp2#
您有
ROS_VERSION=2
和ROS_DISTRO=foxy
,但是其余的引用noetic
。尝试执行export ROS_VERSION=1
和export ROS_DISTRO=noetic
。我不知道你是如何获得你的工作空间的,但是如果你的
bashrc
中有它,我建议你删除它并手工获得它。