Message files not being generated properly with catkin_make
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 ...
Please include the relevant
CMakeLists.txt
files in your question (without all the boilerplate comments), as well as thepackage.xml
files. Without those it's going to be hard to provide pointers.I've updated the description with links to the CMakeLists.txt and package.xml files.
Please also include the exact error message in your question.
Sorry about that, I've updated the description to include the compile output.
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.
Sure I can do that. I just thought the question would be too long with all that stuff in there.