Fibonacci_Server.cpp is not compiled during catkin_make
CMakeText.txt file attached below. This is located in ~/catkinws/src/actionlibtutorials:
cmake_minimum_required(VERSION 2.8.3)
project(actionlib_tutorials)
## Compile as C++11, supported in ROS Kinetic and newer
#add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
message_generation
roscpp
rospy
std_msgs
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
add_action_files(
DIRECTORY action
FILES Fibonacci.action
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
actionlib_msgs std_msgs
)
################################################
## Declare ROS dynamic reconfigure parameters ##
################################################
## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES actionlib_tutorials
CATKIN_DEPENDS actionlib actionlib_msgs message_generation roscpp rospy std_msgs
DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/actionlib_tutorials.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
add_executable(fibonacci_server src/fibonacci_server.cpp)
target_link_libraries(
fibonacci_server
${catkin_LIBRARIES}
)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(
fibonacci_server
${actionlib_tutorials_EXPORTED_TARGETS}
)
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )
## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_actionlib_tutorials.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
Hi, I'm running Ubuntu 18.04.2, 64 bit and ROS Melodic. I'v been working through the beginner and tf2 tutorials. All has worked according to the tutorials until I started the actionlibtutorials; specifically Writing a Specific Action Server. Per the tutorial I created and stored Fibonacci.action in actionlibtutorial/action.
fibonacciserver.cpp was copied from the tutorial text and stored in the directory Home/catkinws/src/actionlib_tutorials/src
I have modified the CMakeList.txt and package.xml files located in Home/catkinws/src/actionlibtutorials and double/triple checked them against the tutorials; in particular against the one entitled "The minimal entire CMakeLists.txt would look like this: in section 3 of the tutorial.
When I now run catkinmake from my ~/catkinws directory I get the following output in the terminal window:
ray@ray-latitude-e6510:~/catkin_ws$ catkin_make
Base path: /home/ray/catkin_ws
Source space: /home/ray/catkin_ws/src
Build space: /home/ray/catkin_ws/build
Devel space: /home/ray/catkin_ws/devel
Install space: /home/ray/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/ray/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ray/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/ray/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/ray/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.15", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ray/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.15")
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 3 packages in topological order:
-- ~~ - beginner_tutorials
-- ~~ - actionlib_tutorials
-- ~~ - learning_tf2
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- beginner_tutorials: 1 messages, 1 services
CMake Warning at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:166 (message):
catkin_package() DEPENDS on 'system_lib' but neither
'system_lib_INCLUDE_DIRS' nor 'system_lib_LIBRARIES' is defined.
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
beginner_tutorials/CMakeLists.txt:109 (catkin_package)
-- +++ processing catkin package: 'actionlib_tutorials'
-- ==> add_subdirectory(actionlib_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Generating .msg files for action actionlib_tutorials/Fibonacci /home/ray/catkin_ws/src/actionlib_tutorials/action/Fibonacci.action
-- actionlib_tutorials: 7 messages, 0 services
CMake Warning at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:166 (message):
catkin_package() DEPENDS on 'system_lib' but neither
'system_lib_INCLUDE_DIRS' nor 'system_lib_LIBRARIES' is defined.
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
actionlib_tutorials/CMakeLists.txt:107 (catkin_package)
-- +++ processing catkin package: 'learning_tf2'
-- ==> add_subdirectory(learning_tf2)
If I try to rosrun actionlibtutorials fibonacciserver I get an error message saying [rosrun] Couldn't find executable named fibonacciserver below /home/ray/catkinws/src/actionlibtutorials. Also, none of the .h Include files are generated in devel/include/actionlibtutorials but the .msg files are created in devel/share/actionlib_tutorials/msg
Could anyone give me a few suggestions on why fibonacciserver.cpp is not being complied? Is it related to fact that catkingmake is also not generating the include files?
Since I'm a newbie on thise boards, I don't have enough points to upload my CMakeText.txt file but would be happy to email it if if would help.
Ray
Asked by rayrv9a on 2019-02-25 17:14:19 UTC
Answers
I've been able to resolve this issue on my own. My end goal has been to build a Linorobot (www.linorobot.org) But, never having built a robot and being a complete newbie to ROS, I first went through all the beginner tutorials in ROS.org and then started going through the pdf book, ROS_by_example_v1. It recommends the tf and actionlib tutorials in addition to the ROS beginner ones. As a result of these tutorials, I have within my ~/catkin_ws/src folder three packages; beginner_tutorials, learning_tf2 & actionlib_tutorials. With all three packages in the src file, when I run catkin_make, the issue described in my original post occurs. However, if I remove the learning_tf2 package and run catkin_make again, everything works; fibonacci_server.cpp is compiled and linked and rosrun actionlib_tutorials fibonacci_server does invoke the server!
The issue is that when catkin_make processes the catkin package learning_tf2 (in the case of that also being in the src file), it throws an error relating to turtlesim. It then continues on and processes actionlib_tutorials but does not compile fibonacci_server.cpp nor does it make the .h include files associated with the action messages. Removing learning_tf2 from the src file, or fixing the dependency issue for turlesim, allows catkin_make to finish without errors (but still with a few warnings) and for the .cpp file to be compiled.
Thanks to those who tried to help solve this problem.
Onward.
Ray
Asked by rayrv9a on 2019-02-27 16:01:17 UTC
Comments
please don't upload your
CMakeLists.txt
but edit your question and copy'n'paste it. Then format it with the preformatted text button (the one with 1001010) on it.Header files (except for the ones from messages) are not "generated" and don't end up in
devel
by default...Asked by mgruhler on 2019-02-26 02:00:33 UTC
Can you add you CMakeLists.txt file that you're using to you question. That is probably where the problem lies, so we'll need to see it to be able to help you.
Asked by PeteBlackerThe3rd on 2019-02-26 07:52:07 UTC
Above, at the top of this thread, I have added my CMakeText.txt file which is located at ~/catkin_ws/src/actionlib_tutorials. Per your comments above, can you please review and let me know what is wrong/missing in the CMakeText file?
Asked by rayrv9a on 2019-02-27 08:06:27 UTC
To be honest, I'm not sure. I've compared it to some of my code that works with action servers and the
CMakeLists.txt
file looks like it should work. The only difference is that I'm on Ubuntu 16.04 and ROS kinetic, so I can't tell you if there should be a difference for the newer version.Asked by PeteBlackerThe3rd on 2019-02-27 08:59:58 UTC