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

error starts with "execute_process..." when run cmakelists.txt in qt creator

asked 2017-06-20 22:40:53 -0500

Minos gravatar image

updated 2022-01-22 16:16:35 -0500

Evgeny gravatar image

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?

edit retag flag offensive close merge delete

Comments

1

Is there more to the error message? Have you sourced the setup.bash for your workspace before you run qt creator?

ahendrix gravatar image ahendrix  ( 2017-06-20 23:13:13 -0500 )edit

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

Minos gravatar image Minos  ( 2017-06-21 01:09:36 -0500 )edit

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:

Minos gravatar image Minos  ( 2017-06-21 01:10:31 -0500 )edit

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.

Minos gravatar image Minos  ( 2017-06-21 01:10:58 -0500 )edit

Sorry for dividing, but the reply character limit catches me.

Minos gravatar image Minos  ( 2017-06-21 01:12:01 -0500 )edit

I sourceed setup.bash by source "echo /opt/....", "source ~/.bashrc". And catkin_init_workspace is also done.

Minos gravatar image Minos  ( 2017-06-21 01:13:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-26 04:43:44 -0500

Minos gravatar image

updated 2017-06-26 11:17:14 -0500

Oh, yeah I see it just now. I figured out how to compile via qt. Thanks alot ahendrix!

[Edit]

Just note. If you want to solve the same problem, just follow the steps in ROS wiki - ROS IDE(Qt Creator). Especially, making a .desktop file is most IMPORTANT to solve that problem.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-20 22:37:55 -0500

Seen: 1,185 times

Last updated: Jun 21 '17