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

catkin_make and catkin_tools not finding new msg/srv?

asked 2017-03-17 16:32:11 -0600

130s gravatar image

updated 2017-03-20 14:14:44 -0600

When I add a new .msg (I confirmed for .srv as well) and running catkin build, the new file doesn't seem to be processed. Is this expected, or is there a way to let it find new definition? This doesn't seem to be is also a case with catkin_make.

CWS_PROOV=/tmp/cws_proof
mkdir -p "$CWS_PROOV"/src
cd "$CWS_PROOV"/src
git clone git@github.com:130s/prooving_grounds.git        <-- Merely beginner_tutorials with minor change
cd "$CWS_PROOV"
catkin b
ll ./devel/lib/python2.7/dist-packages/beginner_tutorials/msg
source devel/setup.bash 
roscd beginner_tutorials/
echo "int64 num" > msg/Num4.msg
cd -
catkin b
ll ./devel/lib/python2.7/dist-packages/beginner_tutorials/msg
total 24K
drwxrwxr-x 2 rosnoodle rosnoodle 4.0K Mar 17 14:23 ./
drwxrwxr-x 3 rosnoodle rosnoodle 4.0K Mar 17 14:23 ../
lrwxrwxrwx 1 rosnoodle rosnoodle  111 Mar 17 14:23 __init__.py -> /tmp/cws_proof/devel/.private/beginner_tutorials/lib/python2.7/dist-packages/beginner_tutorials/msg/__init__.py
lrwxrwxrwx 1 rosnoodle rosnoodle  108 Mar 17 14:23 _Num2.py -> /tmp/cws_proof/devel/.private/beginner_tutorials/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num2.py
lrwxrwxrwx 1 rosnoodle rosnoodle  108 Mar 17 14:23 _Num3.py -> /tmp/cws_proof/devel/.private/beginner_tutorials/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num3.py
lrwxrwxrwx 1 rosnoodle rosnoodle  107 Mar 17 14:23 _Num.py -> /tmp/cws_proof/devel/.private/beginner_tutorials/lib/python2.7/dist-packages/beginner_tutorials/msg/_Num.py
ll /tmp/cws_proof/devel/.private/beginner_tutorials/lib/python2.7/dist-packages/beginner_tutorials/msg
    (Num4 not found)
ll ./devel/share/gennodejs/ros/beginner_tutorials/msg
    (Num4 not found)
ll ./devel/share/common-lisp/ros/beginner_tutorials/msg
    (Num4 not found)

$ apt-cache policy python-catkin-tools|grep Inst
  Installed: 0.4.4-1

To work this around I'm removing build, devel before building. After modifying CMakeLists.txt also works for me. Seen on Xenial Kinetic and Trusty Indigo.


UPDATE After listing all .msgs and .srvs in CMakeLists.txt both catkin_make and catkin build seem to find the new files and update to the existing files. It'd be still nice if there's a way to achieve the same without listing them.

edit retag flag offensive close merge delete

Comments

echo "int64 num" > msg/Num4.msg

just making sure: you did add Num4.msg to the add_message_files(..) call in CMakeLists.txt, correct?

gvdhoorn gravatar image gvdhoorn  ( 2017-03-18 05:33:13 -0600 )edit

Nope, only passing DIRECTORY (exact line in my sample). Thanks to this answer (aka yours :)) I've been able to build msgs without specifing FILES. But added files aren't the case, which is my issue.

130s gravatar image 130s  ( 2017-03-18 09:00:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-03-20 14:32:40 -0600

Dirk Thomas gravatar image

As documented by CMake ( https://cmake.org/cmake/help/v3.5/com... ):

We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.

If you glob the files instead of listing them explicitly CMake has no way of knowing when it needs to reconfigure. Therefore you should list them explicitly. Otherwise you need to force the CMake invocation.

edit flag offensive delete link more

Comments

1

Yeah. That's basically what I wrote in the answer to #q212420 that @130s referenced ;)

gvdhoorn gravatar image gvdhoorn  ( 2017-03-20 14:58:08 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-17 16:32:11 -0600

Seen: 754 times

Last updated: Mar 20 '17