ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

CMake produces error after editing CMakelists.txt in ROS beginner tutorial 10

asked 2020-02-06 19:54:38 -0500

abraxasu gravatar image

updated 2020-02-07 03:19:58 -0500

gvdhoorn gravatar image

I have been working through the ROS tutorials and about midway through ROS tutorial 10 where I changed the CMakelists.txt file to the new msg and srv output and went to build catkin again, it now produces the following error:

CMake Error at CMakeLists.txt:56 (find_package):
  find_package called with invalid argument "roscpp"


CMake Error at CMakeLists.txt:66 (message):
  find_package(catkin) failed.  catkin was neither found in the workspace nor
  in the CMAKE_PREFIX_PATH.  One reason may be that no ROS setup.sh was
  sourced before.


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

I believe the second error only arose later because in trying to solve the problem I deleted my entire catkin directory and tried to start again from scratch. However, it continues to try and build from the old CMakelists.txt file. Despite trying to start from scratch many times it continues to be unable to run Cmake.

I have tried to run cmake clean, but after deleting my catkin directory it produces an error that it cannot recognise catkin in my buildpath any longer.

ROS env:

ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROS_PYTHON_VERSION=2
ROS_IP=192.168.100.169
ROS_PACKAGE_PATH=/opt/ros/melodic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=melodic

This is the offending section of CMakelists.txt:

  # search for catkin in all workspaces
  set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
  find_package(catkin QUIET
    roscpp
    rospy
    std_msgs
    message _generation
    NO_POLICY_SCOPE
    PATHS ${catkin_search_path}
    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  unset(CATKIN_TOPLEVEL_FIND_PACKAGE)
edit retag flag offensive close merge delete

Comments

Could you please show your complete CMakeLists.txt? The section you show is not something I would have expected to appear in a standard, regular, package-level build script for a ROS package.

I have been working through the ROS tutorials and about midway through ROS tutorial 10

Please: always link to whatever you are reading/following. We cannot guess what "the ROS tutorials" means (yes, we could assume it means the ones on the main ROS wiki, but when diagnosing problems, assuming things is bad).

gvdhoorn gravatar image gvdhoorn  ( 2020-02-07 03:21:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-09 00:34:31 -0500

abraxasu gravatar image

I realise now that the CMakeLists.txt that I was looking at and posted there was not the package level CMakeLists.txt, but rather the main CMakeLists.txt for the catkin workspace. I have now resolved the problem by simply creating a new workspace entirely and carefully going through all the instructions again.

I think my main concern with the original post was how I could go about refreshing my cmake cache, because it kept referring to a file which I thought I had deleted but was seemingly floating around in memory somewhere.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-02-06 19:52:26 -0500

Seen: 828 times

Last updated: Feb 07 '20