Ask Your Question

How to stop making python targets?

asked 2013-02-06 04:04:26 -0500

Shahbaz gravatar image

updated 2014-01-28 17:15:07 -0500

ngrennan gravatar image

I am developing a ROS module in C++ and following the tutorials, had roscreate-pkg create CMakeLists.txt

The build process is extremely slow though, even though the code is not at all big. I noticed that it takes quite some time to build python scripts for the message and service files (which don't interest me). Including rospy.cmake also takes some time. Overall it takes ~15 seconds before it actually starts compiling.

My question is, how can I modify CMakeLists.txt so that it would not build the python targets and focus only on C++?

This is the initial output of make:

[rosbuild] Building package <omitted>
-- Using CATKIN_DEVEL_PREFIX: /home/<omitted>/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/groovy
-- This workspace overlays: /opt/ros/groovy
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.63
[rosbuild] Including /opt/ros/groovy/share/roscpp/rosbuild/roscpp.cmake
[rosbuild] Including /opt/ros/groovy/share/rospy/rosbuild/rospy.cmake
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:


-- Build files have been written to: /home/<omitted>/build

In this output, after the first line (Building package), it takes ~6 seconds to write the next lines (Using ...) up to the line with "catkin ...". After that, it takes ~4 seconds to write "Including ... roscpp.cmake". It stops for ~9 seconds on that and then goes on to "Including ... rospy.cmake" which takes another ~4 seconds.

It is only then, that it starts actually compiling. This doesn't even include message and service file generations which each take just about ~2-3 seconds for each message and service.

edit retag flag offensive close merge delete


What build system are you using? What do you consider "not at all big"? For the simple beginner_tutorials setup a complete compile on my machine takes about 1s. If the message generation takes 15s something is very wrong.

dornhege gravatar image dornhege  ( 2013-02-06 04:39:22 -0500 )edit

@dornhege, I added more info.

Shahbaz gravatar image Shahbaz  ( 2013-02-06 06:31:51 -0500 )edit

Seems wrong to me and shouldn't take that long. You are doing that on a "normal" PC, right? The only guess I have at this point is that maybe you have large directory structures in your workspace.

dornhege gravatar image dornhege  ( 2013-02-06 22:35:21 -0500 )edit

@dornhege, an Ubuntu patched with RTAI (so, real-time), even though no real-time application is running. What I'm working on is a fresh groovy install with a simple project.

Shahbaz gravatar image Shahbaz  ( 2013-02-07 00:55:15 -0500 )edit

Nevertheless, the question is whether I can turn of "python" code generation and compilation off!

Shahbaz gravatar image Shahbaz  ( 2013-02-07 00:55:38 -0500 )edit

I don't have an answer for that, but fixing the reason why it is so slow in general might be worth more in the long run. I'm sure that would also improve python message generation.

dornhege gravatar image dornhege  ( 2013-02-07 03:05:31 -0500 )edit

Can you update your question with the result of rospack depends1 your_package_name_here?

SL Remy gravatar image SL Remy  ( 2013-02-12 02:08:20 -0500 )edit

I'm also wondering the same question. I have a ROS package with many ROS messages (51) and I only want to generate the proper c++ header files, skipping the generation of the python ones. My package doesn't depends in rospy, but the cmake building process still generating the python files after printing this line: "Scanning dependencies of target ROSBUILD_genmsg_py". Does anyone know if there is any option in rosbuild_genmsg(), rosbuild_init() or in any other place for skipping the generation of python files?

piponazo gravatar image piponazo  ( 2013-08-05 15:51:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-02 03:54:24 -0500

tfoote gravatar image

If you uninstall any of the generators they will not generate. There is not a way to specifically turn of generators for a specific package, because although you know that you don't need the generators for that package. The point of messages is that they can be reused by downstream packages. As well as being able to use tools in python or c++ (For example rostopic echo is a python tool, thus to use standard debugging tools you need the python generated code)

There's a larger problem of your machine running very slowly. On a typical system I would expect what you're talking about to take wholly well under a second. This suggests very slow disk access.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-02-06 04:04:26 -0500

Seen: 177 times

Last updated: Oct 02 '14