# JetBrains CLion IDE setup for ROS

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.

## 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 close merge delete

1
( 2015-06-04 01:39:16 -0600 )edit

Sort by » oldest newest most voted

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.

more

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'.

( 2015-06-04 04:10:39 -0600 )edit
1

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

( 2015-06-04 04:43:45 -0600 )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

( 2015-06-08 12:57:04 -0600 )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.

( 2015-06-26 08:36:45 -0600 )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

( 2015-06-27 05:42:50 -0600 )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.

( 2015-06-29 05:11:29 -0600 )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?

( 2015-11-26 10:14:50 -0600 )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.

( 2015-11-26 11:21:13 -0600 )edit

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.

more