Robotics StackExchange | Archived questions

Migrating from catkin_make to catkin build headers

I am following this guide to migrate from catkin_make to catkin build.

catkinmake builds fine, but in the second step, catkinmake_isolated, I have a great number of errors. Checking the troubleshooting section, it seems that my problem is Missing headers.

Let me show you one error example:

In file included from /home/daniel/my_project_ws/src/my_project_ros/EFIS/src/ND/pilotactionlegtf.cpp:8:0:
/home/daniel/my_project_ws/src/my_project_ros/EFIS/src/ND/pilotactionlegtf.h:12:34: fatal error: pilotactiontfmessage.h: No such file or directory
compilation terminated.
EFIS/src/ND/CMakeFiles/nd.dir/build.make:86: recipe for target 'EFIS/src/ND/CMakeFiles/nd.dir/pilotactionlegtf.cpp.o' failed
make[2]: *** [EFIS/src/ND/CMakeFiles/nd.dir/pilotactionlegtf.cpp.o] Error 1
CMakeFiles/Makefile2:2125: recipe for target 'EFIS/src/ND/CMakeFiles/nd.dir/all' failed
make[1]: *** [EFIS/src/ND/CMakeFiles/nd.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'my_project_ros': 
  Command '['/home/daniel/my_project_ws/devel_isolated/module1/env.sh', 'make', '-j4', '-l4']' returned non-zero exit status 2 
Command failed, exiting.

If I check pilotactionlegtf.h i have:

#include <pilotactiontfmessage.h>

But for some reason it is unable to find it. I can manually change it to:

#include "../../Messages/pilotactiontfmessage.h"

And then the error dissapears, but the number of these problems is too big for manually changing all the cases. All the headers giving fatal error No such file or directory are under src folder in different folders.

Is there any other solution?

EDIT: I add the CMakeLists.txt in src

# 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()

and the CMakeLists.txt in myprojectros

project(my_project_ros)
cmake_minimum_required(VERSION 2.8.8)

if (POLICY CMP0026)
  cmake_policy(SET CMP0026 OLD)
endif()
if (POLICY CMP0037)
  cmake_policy(SET CMP0037 OLD)
endif()

INCLUDE (CheckIncludeFiles)

set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/my_project_ros/cmakeModules/")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native -fomit-frame-pointer -fvisibility=default -fvisibility-inlines-hidden -flto")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -std=c++11 -Wno-sign-compare -pthread")
set (CMAKE_AR  "gcc-ar")
set (CMAKE_RANLIB  "gcc-ranlib")

option(SYSTEM_QCUSTOMPLOT "Use system QCustomPlot library" OFF)

find_package(Boost COMPONENTS regex REQUIRED)
find_package(libusb-1.0 REQUIRED)
find_package(eigen3 REQUIRED)

# QT5
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport Designer)


find_package(catkin REQUIRED
  COMPONENTS
    roscpp
    message_generation
    module1
    std_msgs
)

add_message_files(
  FILES
    BaseFVISMessage.msg
    NDOverlayMessage.msg
    PositionMessage.msg
    LLPoint.msg
    PathMessage.msg
    String.msg
)
generate_messages()

catkin_package(
  CATKIN_DEPENDS roscpp
)

if (SYSTEM_QCUSTOMPLOT)
  find_package(QCustomPlot REQUIRED)
else()
  add_subdirectory(third_party/qcustomplot)
  set (QCUSTOMPLOT_INCLUDE_DIRS "third_party/qcustomplot/")
  set (QCUSTOMPLOT_LIBRARIES "qcustomplot")
endif()

# CPPREST is needed to connect to websockets (e.g. MDPP)
find_path(CPPREST_INCLUDE_DIR ws_client.h
                 /usr/include/cpprest/
                 /usr/local/include/cpprest/)
IF (NOT CPPREST_INCLUDE_DIR)
    message(FATAL_ERROR "cpprest library not found (solution hint: sudo apt-get install libcpprest-dev)")
ENDIF()




include_directories (
  ${catkin_INCLUDE_DIRS}
    ${EIGEN3_INCLUDE_DIR}
    ${LIBUSB1_INCLUDE_DIR}
    ${QCUSTOMPLOT_INCLUDE_DIRS}
    FVISCore
    ${CMAKE_CURRENT_BINARY_DIR}/FVISCore
    include
    SimulatedConfiguration
    FGProcessorModule
    GNSSReceiverConnection
    FlightManagementProcModule
    SyncTriggModule
    NDOverlayModule
    ${cppzmq_INCLUDE_DIR}
)

enable_testing()

add_custom_target(install_default
  ${CMAKE_COMMAND} -DCOMPONENT=Unspecified -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)

add_subdirectory(EFIS)
add_subdirectory(qtMapWidget)
add_subdirectory(qtLEDWidget)
add_subdirectory(SyncTriggModule)
add_subdirectory(FVISPosFileConfiguration)
add_subdirectory(GNSSReceiverConnection)
add_subdirectory(FlightManagementProcModule)
add_subdirectory(FlightGearDataAcquisition)
add_subdirectory(FVISGNSSConfiguration)
add_subdirectory(FVISFlightGearConfiguration)
add_subdirectory(FVISDataLoggingDaemon)
add_subdirectory(FVISCore)
add_subdirectory(SimulatedConfiguration)
add_subdirectory(FGProcessorModule)
add_subdirectory(DataProviderModule)
add_subdirectory(DataAcquisitionModule)
add_subdirectory(FlightPlanValidator)
add_subdirectory(FVIS_MFC_Gui)
add_subdirectory(SUTDataAquisition)
add_subdirectory(LPRDataAcquisition)
add_subdirectory(IMURaspberry)
add_subdirectory(RawLoggingModule)
add_subdirectory(IMUCommon)
add_subdirectory(IMU_MT_LowLevel)
add_subdirectory(module1Module)
add_subdirectory(NDOverlayModule)
add_subdirectory(SatWidgets)
add_subdirectory(IMU_LORDMicroStrain)
add_subdirectory(tests)
add_subdirectory(install)

add_executable(listener listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener generate_messages_cpp)

Asked by danividanivi on 2017-12-04 04:07:07 UTC

Comments

We're going to need to some (an excerpt of) your CMakeLists.txt.

Right now, this reads like a problem with your include paths.

Asked by gvdhoorn on 2017-12-04 04:32:18 UTC

or dependencies. Maybe the message headers are just not created yet. I second @gvdhoorn about the CMakeLists.txt.

Asked by mgruhler on 2017-12-04 05:08:45 UTC

Msg deps could also be a problem, but #include "../../Messages/pilotactiontfmessage.h" does not look like a proper (auto-generated) msg header to me.

Asked by gvdhoorn on 2017-12-04 05:10:56 UTC

I added CmakeLists.txt

Asked by danividanivi on 2017-12-04 06:20:17 UTC

@gvdhoorn it is not, the .msg files are in a different folder with .msg extension.

Asked by danividanivi on 2017-12-04 06:22:22 UTC

Answers