Ask Your Question
0

Message files not being generated properly with catkin_make

asked 2016-05-30 22:54:42 -0500

kPanesar gravatar image

updated 2016-05-31 12:37:47 -0500

I have a workspace with 3 packages: an rqt plugin written in C++ (package A), a package with two custom messages (package B), and another C++ package (package C).

Packages A and C both rely on the custom messages defined in package B. To ensure that the dependencies for the executables in packages A and C are met, I have added the following line for each applicable executable:

add_dependencies(executable_name ${catkin_EXPORTED_TARGETS})

Unfortunately, when I try to compile using catkin_make, I get an error saying that the header file for the messages don't exist. I'm fairly certain this error is coming from package A, the rqt plugin, since doing a catkin_make on package C alone generates no errors and successfully compiles the header files for the messages before trying to compile the executables (and catkin_make on the entire workspace works just fine after that since the header files have already been generated).

How do I go about telling catkin that the rqt plugin depends on the message files? I already have the message package name listed in the CMakeLists.txt file for the plugin as find_package(catkin REQUIRED COMPONENTS package_b) but that doesn't resolve the issue.

I'm currently compiling in ROS Kinetic but this issue existed in Indigo as well before I upgraded.

Any help would be appreciated.


*Update*:

CMakeLists.txt files

Package A:

cmake_minimum_required(VERSION 2.8.3)
project(rqt_gcs)

find_package(catkin REQUIRED COMPONENTS
            query_msgs
            geometry_msgs
            mavros
            mavros_msgs
            roscpp
            rqt_gui
            rqt_gui_cpp
            roslib
            sensor_msgs
            std_msgs
            tf
            cv_bridge
            image_transport
)

find_package(Qt4 COMPONENTS QtCore QtGui QtSvg REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread)
find_package(OpenCV REQUIRED)

include(${QT_USE_FILE})
include(EnableCXX11)
include(MavrosMavlink)

set(rqt_gcs_SRCS
  src/rqt_gcs/simple_gcs.cpp
  src/rqt_gcs/simple_control.cpp
  src/FIS/qfi_PFD.cpp
  src/FIW/LayoutSquare.cpp
  src/FIW/WidgetPFD.cpp
  src/rqt_image_view/ratio_layouted_frame.cpp
)

set(rqt_gcs_HDRS
  include/rqt_gcs/simple_gcs.h
  include/FIS/qfi_PFD.h
  include/FIW/LayoutSquare.h
  include/FIW/WidgetPFD.h
  include/rqt_image_view/ratio_layouted_frame.h
)

set(rqt_gcs_UIS
  resources/gcs.ui
  resources/AccessPointsMenu.ui
  resources/AccessPointStats.ui
  resources/MissionSelect.ui
  resources/MissionCancel.ui
  resources/MissionProgress.ui
  resources/UavStat.ui
  resources/UavQuestion.ui
  resources/QuadStats.ui
  resources/WidgetPFD.ui
  resources/PFDWidget_custom.ui
  resources/WidgetMain.ui
  resources/UAVCondition.ui
  resources/ImageView.ui
  resources/MissionConfirm.ui
  resources/PictureMsg.ui
)

SET(rqt_gcs_RCCS resources/qfi.qrc)

set(rqt_gcs_INCLUDE_DIRECTORIES
  include
  ${CMAKE_CURRENT_BINARY_DIR}
)

catkin_python_setup()

catkin_package(
  INCLUDE_DIRS ${rqt_gcs_INCLUDE_DIRECTORIES}
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS roscpp rqt_gui rqt_gui_cpp std_msgs sensor_msgs
)

include_directories(include
    ${Qt4_INCLUDE_DIRS}
    ${OpenCV_INCLUDE_DIRS}
)

add_definitions(${Qt4_DEFINITIONS})


qt4_add_resources(rqt_gcs_RCC_SRCS ${rqt_gcs_RCCS})
qt4_wrap_cpp(rqt_gcs_MOCS ${rqt_gcs_HDRS})
qt4_wrap_ui(rqt_gcs_UIS_H ${rqt_gcs_UIS})

include_directories(${rqt_gcs_INCLUDE_DIRECTORIES}
                    ${Boost_INCLUDE_DIRS}
                    ${catkin_INCLUDE_DIRS})

# Declare executables with source files
add_executable(simple_control src/rqt_gcs/simple_control.cpp)
add_executable(gps_publisher src/rqt_gcs/gps_publisher.cpp)
add_executable(gps_demo src/rqt_gcs/gps_demo.cpp)
add_executable(connection_manager src/rqt_gcs/connection_manager.cpp)
add_executable(safe_mocap src/rqt_gcs/safe_mocap.cpp)

add_dependencies(simple_control ${catkin_EXPORTED_TARGETS})
add_dependencies(gps_demo ${catkin_EXPORTED_TARGETS})

add_library(${PROJECT_NAME}
            ${rqt_gcs_SRCS}
            ${rqt_gcs_MOCS}
            ${rqt_gcs_UIS_H}
            ${rqt_gcs_RCC_SRCS})

#Specify libraries against which to link
target_link_libraries(simple_control ${catkin_LIBRARIES})
target_link_libraries(gps_publisher ${catkin_LIBRARIES})
target_link_libraries(gps_demo ${catkin_LIBRARIES})
target_link_libraries(connection_manager ${catkin_LIBRARIES})
target_link_libraries(safe_mocap ${catkin_LIBRARIES})
target_link_libraries(  ${PROJECT_NAME}
                        ${catkin_LIBRARIES}
                        ${QT_QTCORE_LIBRARY}
                        ${QT_QTGUI_LIBRARY}
                        ${QT_QTSVG_LIBRARY}
                        ${OpenCV_LIBRARIES}
)

find_package(class_loader)
class_loader_hide_library_symbols(${PROJECT_NAME})

install(FILES plugin.xml
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(TARGETS ${PROJECT_NAME}
  ARCHIVE DESTINATION ...
(more)
edit retag flag offensive close merge delete

Comments

Please include the relevant CMakeLists.txt files in your question (without all the boilerplate comments), as well as the package.xml files. Without those it's going to be hard to provide pointers.

gvdhoorn gravatar imagegvdhoorn ( 2016-05-31 05:23:30 -0500 )edit

I've updated the description with links to the CMakeLists.txt and package.xml files.

kPanesar gravatar imagekPanesar ( 2016-05-31 11:25:40 -0500 )edit

Please also include the exact error message in your question.

Dirk Thomas gravatar imageDirk Thomas ( 2016-05-31 11:47:10 -0500 )edit

Sorry about that, I've updated the description to include the compile output.

kPanesar gravatar imagekPanesar ( 2016-05-31 12:13:40 -0500 )edit

It'd be really nice if you could just include all the console copy/pastes in your question proper. If the pastebins ever goes away, this question will become useless. Same for the github links.

gvdhoorn gravatar imagegvdhoorn ( 2016-05-31 12:22:39 -0500 )edit

Sure I can do that. I just thought the question would be too long with all that stuff in there.

kPanesar gravatar imagekPanesar ( 2016-05-31 12:25:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-05-31 12:33:51 -0500

Dirk Thomas gravatar image

In your CMakeLists.txt you have a library target ${PROJECT_NAME} which compiles all source files into a library. But that target does not have a dependency on ${catkin_EXPORTED_TARGETS}.

edit flag offensive delete link more

Comments

Right, I'm not sure how to go about adding a dependency for that target. I have already tried doing add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS}) but that generates an error saying Cannot add target-level dependencies to non-existent target "rqt_gcs"

kPanesar gravatar imagekPanesar ( 2016-05-31 12:45:37 -0500 )edit

You must add the dependency after the lines containing add_library(${PROJECT_NAME} ....

Dirk Thomas gravatar imageDirk Thomas ( 2016-05-31 12:54:54 -0500 )edit

Wow, that was it! I can now compile repeatedly without any issues. It all makes sense now. Thank you!

kPanesar gravatar imagekPanesar ( 2016-05-31 13:06:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-30 22:54:42 -0500

Seen: 950 times

Last updated: May 31 '16