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

JetBrains CLion IDE setup for ROS

asked 2015-06-03 16:56:08 -0500

alextoind gravatar image

updated 2018-11-29 06:47:50 -0500

I've downloaded it a couple of days ago, but I still have not figure out how to configure it correctly to work with ROS.

If I import a simple ROS project it gives me the following error, but I can compile (and run) it from the terminal:

Error: By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "catkin", but CMake did not find one.
Could not find a package configuration file provided by "catkin" with any of the following names:
  catkinConfig.cmake   catkin-config.cmake
Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set "catkin_DIR" to a directory containing one of the above files.  If "catkin" provides a separate development package or SDK, be sure it has been installed.

I'd like to know where to properly set these environmental variables and how can I get the equivalent of catkin_make from inside the IDE.

Thanks in advance!


EDIT 29.11.2018

After more than three years, thanks to this post and to a couple of similar ones, JetBrains has published an official guide for CLion 2018.3 (which is fine also for previous versions).

You can find it here: https://www.jetbrains.com/help/clion/...

edit retag flag offensive close merge delete

Comments

1
gvdhoorn gravatar image gvdhoorn  ( 2015-06-04 01:39:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
7

answered 2015-06-03 17:40:16 -0500

daenny gravatar image

It does not seem to find the catkin package in your environment variable. How did you start CLion? You should start it from a terminal which has all ROS setup bash scripts loaded. This ensures that all your environment variables are set correctly. For me CLion works out of the box, when I start it in a terminal and I select a CMakelist for the project. I can build, run and debug without any extra configuration hassle.

edit flag offensive delete link more

Comments

Thank you very much, I didn't think about launching from terminal. It works like a charm now! Also, as pointed out by @gvdhoorn, in wiki.ros.org/IDEs there is the explaination for JetBrains PyCharm IDE which I haven't noticed while searching for 'CLion'.

alextoind gravatar image alextoind  ( 2015-06-04 04:10:39 -0500 )edit
1

Might be nice to update the IDEs page to include a reference to your particular one. Would save future users some trouble.

gvdhoorn gravatar image gvdhoorn  ( 2015-06-04 04:43:45 -0500 )edit
2

Following http://wiki.ros.org/IDEs I edited clion *.desktop file as following so that I don't have to start it from command line every time. Exec=bash -i -c " /bin/clion.sh" %f

mahi gravatar image mahi  ( 2015-06-08 12:57:04 -0500 )edit

As suggested, by launching CLion from the terminal, that error doesn't come up anymore. Anyhow the build process doesn't work correctly as it outputs in some CLion system folder. Even if the catkin-generated CMakeCache looks fine, CLion uses a different BINARY_DIR for the project.

bezcoder gravatar image bezcoder  ( 2015-06-26 08:36:45 -0500 )edit

It should be fine to source the proper setup.bash. For example if you are on linux try with: source ~/.clion10/system/cmake/generated/<something>/<something>/Debug/devel/setup.bash

alextoind gravatar image alextoind  ( 2015-06-27 05:42:50 -0500 )edit

That way the building works in CLion but breaks catkin_make, so I don't consider that as a solution. CLion should just use the makefile in the appropriate directory (ros/build/$projectName) but it seems that it is failing at that.

bezcoder gravatar image bezcoder  ( 2015-06-29 05:11:29 -0500 )edit

I agree with @bezcoder that there should be a way to make CLion generate the files in the catkin ws folders. Has anyone advanced with that? Or if there is any way to use the debugger with the catkin_make generated binaries?

gcc05 gravatar image gcc05  ( 2015-11-26 10:14:50 -0500 )edit

@grar05 actually you can use the debugger with binaries generated through build <something> from CLion, even if they are not those in the catkin workspace.

alextoind gravatar image alextoind  ( 2015-11-26 11:21:13 -0500 )edit
0

answered 2017-03-20 11:05:32 -0500

Donny3000 gravatar image

Alternatively, if you are setting up CLion on a Ubuntu/Debian machine (this may work for OSX as well), you can put your

source /opt/ros/{your_ros_distro}/setup.bash

in the ~/.profile (or /etc/profile for system-wide environment setup). This way all logins environments (interactive/non-interactive/graphical) will be populated with the ROS environment variables and it will not matter whether you start CLion from the terminal or the application launcher.

One gotcha however is if ~/.bash_profile exists. In that case, place the setup.bash setup script in the ~/.bash_profile script or modify the ~/.bash_profile script to source the ~./profile script.

edit flag offensive delete link more

Question Tools

4 followers

Stats

Asked: 2015-06-03 16:56:08 -0500

Seen: 19,494 times

Last updated: Nov 29 '18