0
$\begingroup$

Rosanswers logo

I've been using Qtcreator for a long time with rosbuild packages, where it puts the executables in the package/bin/ directory just like rosmake. Using Qtcreator with catkin packages, I can edit and compile the code just fine, but since the binaries aren't put in the catkin_workspace/devel/ path, I still have to run catkin_make by hand for the binaries to be usable. Is there a solution to this that lets Qtcreator put the libraries and executables in the correct location?


Originally posted by Calder on ROS Answers with karma: 161 on 2013-07-12

Post score: 5


Original comments

Comment by William on 2013-07-12:
In catkin we support out of source builds, which is something that QtCreator usually does by default. Why do you think that the bin and lib folders need to be in the package directory?

Comment by Calder on 2013-07-12:
I didn't say that - I'm well aware that catkin puts them outside the package directory. As I noted, the problem is that qtcreator is putting them in the wrong place relative to where catkin_make puts them, which means that the executables aren't used properly.

Comment by William on 2013-07-12:
I see what you are asking now.

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

The problem is that caktin_make calls cmake with -DCATKIN_DEVEL_PREFIX=/path/to/catkin_workspace/devel, but QtCreator is just calling cmake without any arguments. This causes catkin to place the develspace in the default location which is inside the build folder. You can probably add arguments to cmake in the QtCreator settings somewhere.

What I would do is build your workspace once with catkin_make, then open the CMakeLists.txt in the src folder with QtCreator and point QtCreator to the build folder created by catkin_make, then it should inherit all of the CMake settings catkin_make passed along.


Originally posted by William with karma: 17335 on 2013-07-12

This answer was ACCEPTED on the original site

Post score: 9


Original comments

Comment by Calder on 2013-07-12:
That solves the problem. It's not the prettiest solution to put all the packages in one Qtcreator project, but I guess it fits the usage model of catkin better.

Comment by William on 2013-07-12:
I think you can also point QtCreator to the CMakeLists.txt for a single package and then point it at the build/package_name folder for the build space, but I am not sure if that will work.

Comment by Calder on 2013-07-12:
I believe I've tried that, and it doesn't work. Qtcreator ends up making a miniature copy of the devel/ directory structure inside build/package_name directory.

Comment by Augusto Luis Ballardini on 2017-04-12:
I solved the problem by adding CMAKE_PREFIX_PATH + CATKIN_INSTALL_PREFIX + CATKIN_DEVEL_PREFIX inside the "Cmake Configuration" of the QtCreator KIT. Please note that i initially wrote the cmake-prefix using the standard "linux" colon (:) punctuation mark to separate the folders like /pathA:/pathB

Comment by Augusto Luis Ballardini on 2017-04-12:
but inside the QtCreator you need to separate the two paths using the semi-colon ... imho there's a little mess there, since the Cmake path prefix loaded from the environment have the (:) ... maybe this is the reason why it does not automagically works ? CMAKE_PREFIX_PATH is also set in the env

$\endgroup$
0
$\begingroup$

Rosanswers logo

I wrote a short tutorial on this (and also on using CodeBlocks, but QtCreator seems much more responsive).

In short:

  • Replace the src/CMakeLists.txt symlink with an actual file

  • Open qtcreator from the console.

  • File -> “Open File or project…“, then pick ~/catkin_ws/src/CMakeLists.txt and set the build dir to ~/catkin_ws/build/

  • Select the tab Projects -> Build Settings and add these CMake arguments:

    -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel

  • Close & reopen qtcreator (from a console where you sourced ROS setup.bash!) to make sure it generates the project.

  • Ready to go!


Originally posted by Jose Luis Blanco with karma: 288 on 2014-12-19

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by brice rebsamen on 2015-02-03:
I had problems with the symlink, thanks. Instead of launching from a terminal, you can create qtcreator.desktop with the following content and drag it to your launch bar: http://pastebin.com/uw0cxntD

Comment by Simon Schmeisser on 2015-03-04:
If I follow these steps, executables are not found automatically by QtCreator, the other answer (running catkin_make first) works quite fine for me

$\endgroup$
0
$\begingroup$

Rosanswers logo

I would like to add for anyone looking at this question from now on that now you can compile and add one package from your catkin workspace as a project in Qt. With the new catkin_tools package there is no top level cmake file and therefore no symlink issue.

  • To setup your project you first need the catkin tools package. I installed this with apt-get as follows sudo apt-get install python-catkin-tools There are some differences between the tools package and the catkin_make your used to (now its catkin build) but ill leave it to you to read the docs.

  • You will need to reinitialize your catkin workspace. I found that you can just reuse an existing workspace but I I'm not sure if it will cause me issues down the road. First clean your workspace ie delete build and devel. Then run catkin init and it should inherit the configuration from the original workspace. You should see that it is Extending /opt/ros/indigo or similar. If not you'll have to add it. (See:Workspace Chaining)

That should be it for catkin_tools. Now you can build with catkin build instead of catkin_make or clean with catkin clean -a

The rest of the steps are almost identical to @Jose Luis Blanco except that when adding the project add the CMakeLists.txt of the package its self and set the build folder to ws/build/your_package instead of ws/build as before. (See: ROS IDEs)

Also there is another tutorial out there similar to Jose's but has the build settings as follows ../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel if you have that remember to remove the ../src


Originally posted by Mike Hosmar with karma: 43 on 2015-05-27

This answer was NOT ACCEPTED on the original site

Post score: 4


Original comments

Comment by Simon Schmeisser on 2016-04-29:
This really works the best and should be upvoted some more. Don't forget the section about modifing qtcreator.desktop at ROS wiki: ROS IDEs

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.