skip to Main Content

I have updated cmake and when i run catkin_make into the catkin_ws i got error in cmake even if got sudo apt update and sudo apt upgrade successful.

cd ~/catkin_ws
catkin_make

Below error is shown Cmake Error, cmake_check_build_system’ failed.

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

I couldn’t solve? How can solve it?

2

Answers


  1. you have ROS_VERSION=2 and ROS_DISTRO=foxy, however, the rest refers to noetic. Try doing export ROS_VERSION=1 and export ROS_DISTRO=noetic.

    I don’t know how you are sourcing your workspace, but if you have that in your bashrc, I suggest removing it and sourcing it manually.

    Login or Signup to reply.
  2. Based on your comment you’re mixing ROS versions in your workspace. This isn’t valid in the same worksapce. You might have a system that uses both, but they should be built within different contexts; i.e. a directory shouldn’t contain both. It also should be noted that catkin isn’t the build system for ROS2(colcon is).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search