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

beginner tutorial catkin_make error directory not found

asked 2013-07-15 22:59:48 -0500

pelment gravatar image

updated 2014-01-28 17:17:16 -0500

ngrennan gravatar image

I try to catkin_make packages but it fais:

CMake Error at /opt/ros/groovy/share/genmsg/cmake/genmsg-extras.cmake:64 (message) : add_message_files() directory not found: /home/user/catkin_ws/src/msg

I can't understand why it tries to find msg files in src/msg.

catkin_ws/src/beginner_tutorials/CMakeList.txt

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

find_package(catkin REQUIRED PACKAGES roscpp rospy std_msgs message_generation)

add_message_files(FILES Num.msg)
add_service_files(FILES AddTwoInts.srv)

generate_messages(DEPENDENCIES std_msgs)

catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
DEPENDS system_lib)

include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_message_cpp)

add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_message_cpp)

catkin_ws/src/CMakeLists.txt

    cmake_minimum_required(VERSION 2.8.3)
    project(beginner_tutorials)

    find_package(catkin REQUIRED PACKAGES roscpp rospy std_msgs message_generation)

    add_message_files(FILES Num.msg)
    add_service_files(FILES AddTwoInts.srv)

    generate_messages(DEPENDENCIES std_msgs)

    catkin_package(
    INCLUDE_DIRS include
    CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
    DEPENDS system_lib)

    include_directories(include ${catkin_INCLUDE_DIRS})

    add_executable(talker src/talker.cpp)
    target_link_libraries(talker ${catkin_LIBRARIES})
    add_dependencies(talker beginner_tutorials_generate_message_cpp)

    add_executable(listener src/listener.cpp)
    target_link_libraries(listener ${catkin_LIBRARIES})
    add_dependencies(listener beginner_tutorials_generate_message_cpp)
edit retag flag offensive close merge delete

Comments

Can you please be more clear and explain more about what you are doing. Can you tell me if you sourced the file and can you output you ROS path.

Asfandyar Ashraf Malik gravatar image Asfandyar Ashraf Malik  ( 2013-07-15 23:23:03 -0500 )edit

ROS_ROOT=/opt/ros/groovy/share/ros, I'm studying tutorial "Writing a Simple Publisher and Subscriber (C++)" and try to make packages. Previously I created msg and srv files in corresponding paths in beginner_tutorial.

pelment gravatar image pelment  ( 2013-07-15 23:38:14 -0500 )edit

Could you show your CMake file ?

Lucile gravatar image Lucile  ( 2013-07-16 01:21:08 -0500 )edit

Done, Lucile

pelment gravatar image pelment  ( 2013-07-16 01:42:37 -0500 )edit

Did you generate your catkin workspace with catkin_init_workspace ? If so, your catkin_ws/src/CMakeLists.txt should be totally different. Anyway, you ask for Num.msg and AddTwoInts.srv in src folder and I think that's why cmake looks for them in src/msg folder.

Lucile gravatar image Lucile  ( 2013-07-16 01:49:54 -0500 )edit

Yes, but I accidentally delete CMakeLists.txt in catkin_ws/src and tried to generate it using catkin_init_workspace once again, and it created that file. I can't find an example of necessary file to copy in catkin_ws/src.

pelment gravatar image pelment  ( 2013-07-16 02:05:30 -0500 )edit

just do another catkin_workspace then to run the publisher example.

Lucile gravatar image Lucile  ( 2013-07-16 02:34:29 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-03-23 02:21:56 -0500

130s gravatar image

Not sure which tutorial you were referring to, but assuming it was one of basic tutorials listed here:

directory not found: /home/user/catkin_ws/src/msg

No tutorial instructs you to create a msg directory under src directory. Instead, like this section, you're supposed to create INSIDE of a beginner_tutorials package.

catkin_ws/src/beginner_tutorials/CMakeList.txt

So yes, CMakeLists.txt you were editing is for beginner_tutorials package, and because the add_message_files macro is in there, it should make sense to you to have msg in the package too.

edit flag offensive delete link more
0

answered 2013-07-21 23:47:16 -0500

pelment gravatar image

The problem was in the CMakeLists.txt in the root catkin workspace path. If you remove this file, the command "catkin_init_workspace" will create a new one, but it will be different and wrong. So I copied it from Beginner Tutorial github repository. :) But, notably, the command catkin_init_workspace works strange in this situation.

edit flag offensive delete link more

Comments

-1. You must have done something wrong. See my answer.

130s gravatar image 130s  ( 2017-03-23 02:22:47 -0500 )edit

Question Tools

Stats

Asked: 2013-07-15 22:59:48 -0500

Seen: 3,713 times

Last updated: Mar 23 '17