CMake error while integrating catkin workspace with qtCreator
Hi all,
I am trying to open a ros package in Qt Creator following http://wiki.ros.org/IDEs . In Qtcreator, I opened the CmakeLists.txt file from ~/catkin_ws/src and changed the build directory properly to ~/catkin_ws/build and then ran cmake. I am following this answer.
Also, I set the cmake arguments for devel and install directories properly which are inside catkin_ws using this line
-DCMAKE_INSTALL_PREFIX=/home/sharath/catkin_ws/install
-DCATKIN_DEVEL_PREFIX=/home/sharath/catkin_ws/devel
But when I run cmake in qtCreator, I get the following error:
CMake Error at /opt/ros/indigo/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python
"/home/sharath/catkin_ws/build/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/indigo/share/catkin/cmake/all.cmake:186 (safe_execute_process)
/opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
File "/home/sharath/catkin_ws/build/catkin_generated/generate_cached_setup.py", line 20, in <module>
from catkin.environment_cache import generate_environment_script
ImportError: No module named catkin.environment_cache
Traceback (most recent call last):
-- Using CATKIN_DEVEL_PREFIX: /home/sharath/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH:
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/sharath/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.14
-- Configuring incomplete, errors occurred!
See also "/home/sharath/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/sharath/catkin_ws/build/CMakeFiles/CMakeError.log".
Here are the problems I am facing,
1) First of all , the above error appears . I tried updating the python modules by sudo pip install -U catkin_pkg
but that does not help.
2) Also interestingly after running the cmake in qtcreator , my catkin_make
doesn't run in the ~/catkin_ws
Now I cannot use ros aliases like roscore and stuff even though I have already sourced catkin_ws/devel/setup.bash and also /opt/ros/indigo/setup.bash
in my bashrc. Restarted the terminal , but still catkin_make and aliases dont run. However this gets solved the moment I source again inside terminal for /opt/ros/indigo/setup.bash
. This solves and now all ros commands work normally without sourcing only until I run Cmake from qtcreator and then ros commands dont work and need to be sourced again from terminal. Is the setup.bash in catkin_ws/devel getting modified or something ?
3) However my main problem is how to solve the qt creator error above.?
I tried setting up the workspace again but these problems recur in the same manner. There's something I am missing.
Update:
Thanks @Simon for the answer! I tried the "old_way" mentioned in the answer and replaced the CMakeLists.txt in the ~/catkin_ws/src/ with the file it links to. Then, I opened that CMakefile in qtcreator and specified build directory as ~/catkin_ws/build/ and then ran cmake and then, I get the same error as mentioned above. Now, when I run catkin_make ...
how do you open qtcreator?
I seem to have the same problem on a Mac. My guess is that qtCreator (which I start from the terminal by calling "/path/to/Qt Creator.app/Contents/MacOS/Qt\ Creator) is not starting cmake in the same environment with the same environment variables, as the one from which qtcreator itself was started
Hi Naman, I've got exactly the same issue. Did you finally manage to fix this? I'm quite a beginner with Cmake and ROS. I tried many things but nothing successful.. thanks
I'm not sure what exactly you mean by "same", but try the following:
hello, I also encounter this problem, have you solved the problem?