Robotics StackExchange | Archived questions

Troubleshoot CMake Error

Hello,

I am trying to set up the Quadrotor indoor SLAM demo on Ubuntu 16.04 and kinetic, and am running into a variety of issues.

Firstly, the ROS package repo does not seem to contain the sudo apt-get install ros-hydro-hector-quadrotor-demo package specified on the page.

Proceeding to install from source, I follow the directions as follows:

mkdir ~/hector_quadrotor_tutorial

cd ~/hector_quadrotor_tutorial

wstool init src https://raw.github.com/tu-darmstadt-ros-pkg/hector_quadrotor/hydro-devel/tutorials.rosinstall

catkin_make

Running catkin_make generates the following error:

Base path: /home/cipher813/hector_quadrotor_tutorial
Source space: /home/cipher813/hector_quadrotor_tutorial/src
Build space: /home/cipher813/hector_quadrotor_tutorial/build
Devel space: /home/cipher813/hector_quadrotor_tutorial/devel
Install space: /home/cipher813/hector_quadrotor_tutorial/install
Creating symlink "/home/cipher813/hector_quadrotor_tutorial/src/CMakeLists.txt" pointing to "/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/cipher813/hector_quadrotor_tutorial/src -DCATKIN_DEVEL_PREFIX=/home/cipher813/hector_quadrotor_tutorial/devel -DCMAKE_INSTALL_PREFIX=/home/cipher813/hector_quadrotor_tutorial/install -G Unix Makefiles" in "/home/cipher813/hector_quadrotor_tutorial/build"
####
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/cipher813/hector_quadrotor_tutorial/devel
-- Using CMAKE_PREFIX_PATH: /home/cipher813/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/cipher813/catkin_ws/devel;/opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- 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/cipher813/hector_quadrotor_tutorial/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 37 packages in topological order:
-- ~~  - hector_components_description
-- ~~  - hector_gazebo (metapackage)
-- ~~  - hector_gazebo_worlds
-- ~~  - hector_localization (metapackage)
-- ~~  - hector_models (metapackage)
-- ~~  - hector_quadrotor
-- ~~  - hector_quadrotor_demo
-- ~~  - hector_quadrotor_description
-- ~~  - hector_sensors_description
-- ~~  - hector_sensors_gazebo
-- ~~  - hector_slam (metapackage)
-- ~~  - hector_slam_launch
-- ~~  - hector_xacro_tools
-- ~~  - hector_uav_msgs
-- ~~  - hector_map_tools
-- ~~  - hector_nav_msgs
-- ~~  - hector_geotiff
-- ~~  - hector_geotiff_plugins
-- ~~  - hector_marker_drawing
-- ~~  - hector_quadrotor_controller
-- ~~  - hector_quadrotor_controller_gazebo
-- ~~  - hector_quadrotor_model
-- ~~  - hector_quadrotor_teleop
-- ~~  - hector_compressed_map_transport
-- ~~  - hector_gazebo_plugins
-- ~~  - hector_imu_attitude_to_tf
-- ~~  - hector_imu_tools
-- ~~  - hector_map_server
-- ~~  - hector_pose_estimation_core
-- ~~  - hector_pose_estimation
-- ~~  - hector_quadrotor_gazebo_plugins
-- ~~  - hector_quadrotor_pose_estimation
-- ~~  - hector_trajectory_server
-- ~~  - message_to_tf
-- ~~  - hector_mapping
-- ~~  - hector_gazebo_thermal_camera
-- ~~  - hector_quadrotor_gazebo
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'hector_components_description'
-- ==> add_subdirectory(hector_models/hector_components_description)
-- +++ processing catkin metapackage: 'hector_gazebo'
-- ==> add_subdirectory(hector_gazebo/hector_gazebo)
-- +++ processing catkin package: 'hector_gazebo_worlds'
-- ==> add_subdirectory(hector_gazebo/hector_gazebo_worlds)
-- +++ processing catkin metapackage: 'hector_localization'
-- ==> add_subdirectory(hector_localization/hector_localization)
-- +++ processing catkin metapackage: 'hector_models'
-- ==> add_subdirectory(hector_models/hector_models)
-- +++ processing catkin package: 'hector_quadrotor'
-- ==> add_subdirectory(hector_quadrotor/hector_quadrotor)
-- +++ processing catkin package: 'hector_quadrotor_demo'
-- ==> add_subdirectory(hector_quadrotor/hector_quadrotor_demo)
-- +++ processing catkin package: 'hector_quadrotor_description'
-- ==> add_subdirectory(hector_quadrotor/hector_quadrotor_description)
-- +++ processing catkin package: 'hector_sensors_description'
-- ==> add_subdirectory(hector_models/hector_sensors_description)
-- +++ processing catkin package: 'hector_sensors_gazebo'
-- ==> add_subdirectory(hector_gazebo/hector_sensors_gazebo)
-- +++ processing catkin metapackage: 'hector_slam'
-- ==> add_subdirectory(hector_slam/hector_slam)
-- +++ processing catkin package: 'hector_slam_launch'
-- ==> add_subdirectory(hector_slam/hector_slam_launch)
-- +++ processing catkin package: 'hector_xacro_tools'
-- ==> add_subdirectory(hector_models/hector_xacro_tools)
-- +++ processing catkin package: 'hector_uav_msgs'
-- ==> add_subdirectory(hector_quadrotor/hector_uav_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- hector_uav_msgs: 21 messages, 0 services
-- +++ processing catkin package: 'hector_map_tools'
-- ==> add_subdirectory(hector_slam/hector_map_tools)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'Eigen' but neither 'Eigen_INCLUDE_DIRS' nor
  'Eigen_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  hector_slam/hector_map_tools/CMakeLists.txt:51 (catkin_package)


-- +++ processing catkin package: 'hector_nav_msgs'
-- ==> add_subdirectory(hector_slam/hector_nav_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- hector_nav_msgs: 0 messages, 5 services
-- +++ processing catkin package: 'hector_geotiff'
-- ==> add_subdirectory(hector_slam/hector_geotiff)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake (found suitable version "4.8.7", minimum required is "4.6") 
-- +++ processing catkin package: 'hector_geotiff_plugins'
-- ==> add_subdirectory(hector_slam/hector_geotiff_plugins)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'hector_marker_drawing'
-- ==> add_subdirectory(hector_slam/hector_marker_drawing)
-- +++ processing catkin package: 'hector_quadrotor_controller'
-- ==> add_subdirectory(hector_quadrotor/hector_quadrotor_controller)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
  Could not find a package configuration file provided by
  "hardware_interface" with any of the following names:

    hardware_interfaceConfig.cmake
    hardware_interface-config.cmake

  Add the installation prefix of "hardware_interface" to CMAKE_PREFIX_PATH or
  set "hardware_interface_DIR" to a directory containing one of the above
  files.  If "hardware_interface" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  hector_quadrotor/hector_quadrotor_controller/CMakeLists.txt:7 (find_package)


-- Could not find the required component 'hardware_interface'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by
  "hardware_interface" with any of the following names:

    hardware_interfaceConfig.cmake
    hardware_interface-config.cmake

  Add the installation prefix of "hardware_interface" to CMAKE_PREFIX_PATH or
  set "hardware_interface_DIR" to a directory containing one of the above
  files.  If "hardware_interface" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  hector_quadrotor/hector_quadrotor_controller/CMakeLists.txt:7 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/cipher813/hector_quadrotor_tutorial/build/CMakeFiles/CMakeOutput.log".
See also "/home/cipher813/hector_quadrotor_tutorial/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

Contents of CMakeLists.txt:

# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 2.8.3)

set(CATKIN_TOPLEVEL TRUE)

# search for catkin within the workspace
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)
  # searching fot catkin resulted in an error
  string(REPLACE ";" " " _cmd_str "${_cmd}")
  message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
endif()

# include catkin from workspace or via find_package()
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()
  # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
  # or CMAKE_PREFIX_PATH from the environment
  if(NOT DEFINED CMAKE_PREFIX_PATH)
    if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
      string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
    endif()
  endif()

  # list of catkin workspaces
  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()

  # search for catkin in all workspaces
  set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
  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()

It appears that an issue may be with a hardware_interface dependency but I am not sure how to edit the CMakeLists.txt file to get it to work.

My purpose is to set up a drone learning environment where I could apply various reinforcement learning techniques.

Your guidance is sincerely appreciated!

Asked by cipher813 on 2018-04-22 15:46:55 UTC

Comments

You posted the wrong CMakeLists.txt... for anyone to help they would need to see this one: hector_quadrotor/hector_quadrotor_controller/CMakeLists.txt. From the errors, it looks like you have at least 2 problems. (1) you are missing the hardware_interface

Asked by jarvisschultz on 2018-04-22 17:58:34 UTC

package (may be possible to install from apt-get) (2) the version of hector_slam that you're using isn't finding Eigen properly.

Asked by jarvisschultz on 2018-04-22 18:00:22 UTC

What version of ROS are you using? On 16.04, it would seem likely you are on Kinetic (or at least not Hydro). Following directions for the wrong version of ROS is generally not a great idea. You definitely won't find ros-hydro-hector-quadrotor-demo if you are on 16.04. You could try installing...

Asked by jarvisschultz on 2018-04-22 18:02:50 UTC

... the hector quadrotor packages for your version of ROS from apt-get. E.g. sudo apt-get install ros-kinetic-hector-quadrotor. Easier than building from source if you don't have a good reason to build from source.

Asked by jarvisschultz on 2018-04-22 18:03:58 UTC

It looks like there were several dependencies that I was missing, rectified with sudo apt-get install ros-kinetic-<package> including hardware_interface controller-interface geographic_msgs gazebo-ros-pkgs gazebo-ros-control. Was able to load after dependencies installed - thanks!

Asked by cipher813 on 2018-04-22 20:39:31 UTC

And to clarify, there was no apt-get version of the sorftware so building from source was required. And am using kinetic on ubuntu 16.04.

Asked by cipher813 on 2018-04-22 20:40:15 UTC

@cipher813: installing dependencies manually is not the recommend way to do this.

Please see #q252478 for the general workflow and the use of rosdep.

Asked by gvdhoorn on 2018-04-23 01:01:33 UTC

Answers