2

I have been working within a catkin workspace for ROS and just tried to rebuild it after building another node ("motion_controller.py") within the "motion_controller" package. When I try to rebuild the package, I get the following error:

CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_py_LINK_EXECUTABLE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_py_LINK_EXECUTABLE
make: *** [cmake_check_build_system] Error 1
cd /home/cdegner/create_ws/build/motion_controller; catkin build --get-env motion_controller | catkin env -si  /usr/bin/make cmake_check_build_system; cd -

This is the code I have added to the CMAKE.txt file within the package motion_controller, which worked when compiling the package for the first time with just one package.

    add_executable(motion_controller src/motion_controller.py)
    target_link_libraries(motion_controller ${catkin_LIBRARIES})
set_target_properties(motion_controller PROPERTIES LINKER_LANGUAGE py)

I tried to change the last line above to:

set_target_properties(motion_controller PROPERTIES LINKER_LANGUAGE CMAKE_py_LINK_EXECUTABLE)

and I just get the error

    CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CMAKE_py_LINK_EXECUTABLE_LINK_EXECUTABLE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CMAKE_py_LINK_EXECUTABLE_LINK_EXECUTABLE
make: *** [cmake_check_build_system] Error 1
cd /home/cdegner/create_ws/build/motion_controller; catkin build --get-env motion_controller | catkin env -si  /usr/bin/make cmake_check_build_system; cd -

For reference, it is throwing an error for multiple nodes, but the other node was compiling fine before adding the new node.

Error after adding enable_language(py) line:

![1]: https://i.stack.imgur.com/yrqum.png

cdegner
  • 21
  • 2
  • It smells like you place your code before `project()` or `enable_languate()` call, which enables "py" language (whatever it means). Like in that question: https://stackoverflow.com/questions/42017111/cmake-error-required-internal-cmake-variable-not-set – Tsyvarev Oct 25 '21 at 18:15
  • @Tsyvarev The first two lines of my code are the `cmake_minimum_required(VERSION 3.0.2) project(motion_controller)` so I don't think that is the issue. I added a line right after this as `enable_language(py)` but now I have a new set of errors. (Pictured in original post.) – cdegner Oct 25 '21 at 18:50
  • Is `motion_controller` an external ROS package that you cloned or did you create it? – BTables Oct 25 '21 at 20:36
  • @BTables I created it. I was able to get a simple subscriber and publisher working within it before I rebuilt it. – cdegner Oct 26 '21 at 17:46

0 Answers0