0
$\begingroup$

Rosanswers logo

Hello respected members! I am having trouble with building the package. First i created the package. and then modified CMakelist.txt and Package.xml files. as required. But when I build the package, it gives me this error

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:224 (message):
  catkin_package() DEPENDS on the catkin package 'message_generation' which
  must therefore be listed as a run dependency in the package.xml

I can't understand this message. My TXT and XML files are given bellow. Please help me. Thanks in advance

<?xml version="1.0"?>
<package format="2">
  <name>ros_tutorials_topic</name>
  <version>0.0.0</version>
  <description>The ros_tutorials_topic package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
  <maintainer email="[email protected]">ibrahim</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>


  <!-- Url tags are optional, but multiple are allowed, one per tag -->
  <!-- Optional attribute type can be: website, bugtracker, or repository -->
  <!-- Example: -->
  <!-- <url type="website">http://wiki.ros.org/ros_tutorials_topic</url> -->


  <!-- Author tags are optional, multiple are allowed, one per tag -->
  <!-- Authors do not have to be maintainers, but could be -->
  <!-- Example: -->
  <!-- <author email="[email protected]">Jane Doe</author> -->


  <!-- The *depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->
  <!-- Examples: -->
  <!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
  <!--   <depend>roscpp</depend> -->
  <!--   Note that this is equivalent to the following: -->
  <!--   <build_depend>roscpp</build_depend> -->
  <!--   <exec_depend>roscpp</exec_depend> -->
  <!-- Use build_depend for packages you need at compile time: -->
     <build_depend>message_generation</build_depend> 
  <!-- Use build_export_depend for packages you need in order to build against this package: -->
  <!--   <build_export_depend>message_generation</build_export_depend>  -->
  <!-- Use buildtool_depend for build tool packages: -->
  <!--   <buildtool_depend>catkin</buildtool_depend> -->
  <!-- Use exec_depend for packages you need at runtime: -->
         <exec_depend>message_runtime</exec_depend>
  <!-- Use test_depend for packages you need only for testing: -->
  <!--   <test_depend>gtest</test_depend> -->
  <!-- Use doc_depend for packages you need only for building documentation: -->
  <!--   <doc_depend>doxygen</doc_depend> -->
  <buildtool_depend>catkin</buildtool_depend>   
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

CMakelists:

## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
  #INCLUDE_DIRS include
 #LIBRARIES ros_tutorials_topic
  CATKIN_DEPENDS message_generation roscpp 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}
)

## Declare a C++ library
add_library(${PROJECT_NAME} src/${PROJECT_NAME}/ros_tutorials_topic.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(${PROJECT_NAME}_node src/ros_tutorials_topic_node.cpp)
 ##added new lines
 add_executable(topic_publisher src/topic_publisher.cpp)
 add_executable(topic_subscriber src/topic_subscriber.cpp)


## 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(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
 target_link_libraries(${PROJECT_NAME}_node
   ${catkin_LIBRARIES}
 )

Originally posted by Ibrahim_aerospace on ROS Answers with karma: 93 on 2018-03-20

Post score: 0


Original comments

Comment by gvdhoorn on 2018-03-20:
Please fix the formatting of your question.

Use the Preformatted Text button for that (the one with 101010 on it).

Please also then remove all the comments from your package.xml and CMakeLists.txt, they are not needed.

Comment by Ibrahim_aerospace on 2018-03-20:
can you please have a look again ? bunch of thanks

Comment by gvdhoorn on 2018-03-20:
Did you just completely rewrite your question?

Please don't do that. If you solved your earlier problem, then accept the answer you received and open a new question for your new problem.

I'm going to leave my answer as-is and hope expect you will revert your edit to your question.

Comment by gvdhoorn on 2018-03-20:
I've undone the changes you did to your question and reopened it.

Please click on the checkmark (in the circle) next to the answer to properly mark your question as answered.

We don't close questions here on ROS Answers if/when they're answered.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:224 (message):
catkin_package() DEPENDS on the catkin package 'message_generation' which must therefore be listed as a run dependency in the package.xml

This error message is not that difficult actually, but I can understand you may not be familiar with the terminology that is being used.

The issue is that you have message_generation listed in your catkin_package(.. CATKIN_DEPENDS ..) statement. That is incorrect, it should be message_runtime.

Please carefully review the Catkin documentation on Building messages, services or actions where this is shown. It is also discussed in the Creating a ROS msg and srv tutorial, specifically in the Creating a msg section.


Originally posted by gvdhoorn with karma: 86574 on 2018-03-20

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.