error starts with "execute_process..." when run cmakelists.txt in qt creator
I'm using ubuntu 16.04, and ROS version is Kinetic. I installed by terminal, sudo apt-get install ros-kinetic-desktop-full. qt version is 5.8, qt creator version is 4.3.0. I try to run cmake and build ros project in qt creator environment, but something is wrong, and i don't know why.
Here's my Cmakelist.txt:
cmake_minimum_required(VERSION 2.8.3)
set(CATKIN_TOPLEVEL TRUE)
set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${_cmd}
RESULT_VARIABLE _res
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _res EQUAL 0 AND NOT _res EQUAL 2)
string(REPLACE ";" " " _cmd_str "${_cmd}")
message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
endif()
if(_res EQUAL 0)
set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
# include all.cmake without add_subdirectory to let it operate in same scope
include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE)
add_subdirectory("${_out}")
else()
if(NOT DEFINED CMAKE_PREFIX_PATH)
if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
endif()
endif()
set(catkin_search_path "")
foreach(path ${CMAKE_PREFIX_PATH})
if(EXISTS "${path}/.catkin")
list(FIND catkin_search_path ${path} _index)
if(_index EQUAL -1)
list(APPEND catkin_search_path ${path})
endif()
endif()
endforeach()
set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
=> Following line is line 52 I mention later
find_package(catkin QUIET
NO_POLICY_SCOPE
PATHS ${catkin_search_path}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
unset(CATKIN_TOPLEVEL_FIND_PACKAGE)
if(NOT catkin_FOUND)
message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.")
endif()
endif()
catkin_workspace()
file(GLOB_RECURSE EXTRA_FILES */*)
add_custom_target(${PROJECT_NAME}_OTHER_FILES ALL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES ${EXTRA_FILES})
This code is not modified, but error code occurs like this:
error: execute_process(/usr/bin/python "/home/minominium/catkin_ws/build/catkin_generated/generate_cached_setup.py") returned error code 1 /opt/ros/kinetic/share/catkin/cmake/all.cmake:186 (safe_execute_process) /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:52 (find_package)
Sorry for so long and tired question, but I reeallly need the answer. What should I do?
Is there more to the error message? Have you sourced the setup.bash for your workspace before you run qt creator?
Thanks for responding, ahendrix. This message is printed when I tried to run cmake with toplevel CMakeLists.txt(in ~/workspace/src). Another message is, when I run cmake with each package's CMakeLists(in ~/workspace/src/package).
It says 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.
Sorry for dividing, but the reply character limit catches me.
I sourceed setup.bash by source "echo /opt/....", "source ~/.bashrc". And catkin_init_workspace is also done.