About Catkin_make Xbo_face_msgs

Source: Internet
Author: User

You can compile the build separately Catkin_make xbo_face_msgs_gencpp

Can be generated as Illecoux in the background. http://answers.ros.org/question/52744/how-to-specify-dependencies-with-foo_msgs-catkin-packages/


Specify dependencies with "Foo_msgs" Catkin packages Catkin Services

Asked a Cdellin
352 7

Updated Feb 7 '

Say I have two catkin packages, Foo and foo_msgs, in my workspace. Here's how I currently the have them set up:

Project (FOO_MSGS)
find_package (catkin REQUIRED components message_generation)
add_message_files (
  DIRECTORY msg
  FILES foomsg.msg
)
generate_messages ()
catkin_package (Catkin_depends message_ Runtime
Project (foo)
find_package (catkin REQUIRED components foo_msgs)
catkin_package ()
include_directories ( Include ${catkin_include_dirs})
add_executable (foo foo.cpp)

I find this if I catkin_make foo, the message isn ' t generated. Indeed, Catkin_make Foo_msgs is a no-op. Catkin_make foo_msgs_gencpp Works, however. In order to get Foo to build correctly, I must add the following line to its CMakeLists.txt:

Add_dependencies (foo foo_msgs_gencpp)

Is this? I ' d expect that building of the package foo_msgs would automatically all its generate. Is there a way to make that happen?

Edit: I ' ve approved Williamwoodall ' s answer, although Kruset ' s was just as useful. (I also added the include_directories () line to Foo ' s CMakeLists.txt, which I initially forgot.)

It turns out I solution is correct; The Foo_msgs_gencpp Auto-target should is added as a dependency of the the Foo target. Note this there is some disagreement about whether a different solution should to supported by Catkin; Kruset started a discussion on the topic here.

Since this type of explicit dependency auto-target (_gencpp and _GENPY) are necessary for using ROS Messages/actions/servic Es in any executable, library, or script, I-it should be better documented (I found no reference to it in Catkin/mig Rating_from_rosbuild). Kruset opened a related Rosdistro issue here. Add a comment 3 answers Sort by»oldest newest most voted

answered Feb 6 ' Williamwoodall
1486

Updated Feb ' William
10401 109 191 http://wjwwood.io/

Your projects are setup correctly (mostly), you just need to run catkin_make with no arguments.

The ' I update foo:

Cmake_minimum_required (VERSION 2.8.3)
project (foo)

find_package (Catkin required components)

Catkin_package ()

include_directories (include ${catkin_include_dirs})

add_executable (Foo_node src/foo_ Node.cpp)
add_dependencies (Foo_node foo_msgs_generate_messages_cpp)

Using add_dependencies (...) is by design or necessity, however to it, because we cannot know or assume that Foo ' s Targets (executables or libraries) use and therefore depend on the messages which are getting generated by FOO_MSGS.

Then just execute catkin_make with no arguments.

If you are want to build foo_msgs explicitly (not the whole workspace) then as of Pull request ros/catkin#352 your can do Catki N_make--pkg foo_msgs.

Calling Catkin_make Foo_msgs is isn't sufficient because that are instructing Catkin_make to invoke the Foo_msgs make target Which does not exist. Tkruse ' s solution simply adds a foo_msgs target which depends on the foo_msgs_generate_messages_cpp target and allowing it to Be callable and causing the foo_msgs_generate_messages_cpp target to be generated. This isn't something we do by default because packages often define targets with the same name as the project which Immediately cause a conflict.

The only reliable way to build a entire package (including all of it targets) is to go to the package ' s builds space and Invoke make [all], the which is what Catkin_make--pkg does.

I Setup A example repository here:

Https://github.com/wjwwood/catkin_dem ... Link Comments 1

Hi Williamwoodall, this is very helpful! Clearly the _gencpp dependency needs to go somewhere explicitly. List it in Foo ' s cmakelists file. In this case, if foo_msgs are already installed (so catkin are only building foo), 'll the Foo_msgs_gencpp dependency be co Rrectly resolved by Catkin? Cdellin (Feb 6 ') 1

Yes, CMake'll ignore targets which are not defined, you could add add_dependencies (Foo_node bar_does_not_exist) and it W Ill build with no warnings. Williamwoodall (Feb 6 ')

great! This is my favorite solution, since it doesn ' t introduce new targets (FOO_MSGS), and explicitly encodes the dependency bet Ween the foo (binary) target and the generated CPP messages. Cdellin (Feb 7 ')

Also, I want to stress about catkin_make arguments: (a) Sometimes it are useful to builds only particular targets (yes, Targ ETS, not packages), and (b) running Catkin_make with no arguments doesn ' t; The _gencpp target is still required to ensure targets are in the built order. Cdellin (Feb 7 ')

(a) Building specific target is already supported by ' catkin_make ', any argument without a special meaning is passed Strai Ght forward to "make", the "Catkin_make--help" for details. Dirk Thomas (Feb 7)

Hi dirk! I understand this and I just wanted to correct the answer. I believe that Williamwoodall's assertion that "running catkin_make with no arguments" would somehow fix me problem is Inc Orrect. Cdellin (Feb 7 ') add a comment

answered Aug ' kalakris
469 3 5 7 Http://www-clmc.usc.ed ...

Updated Aug

I believe the modern way of doing this are to add a dependency on ${catkin_exported_targets}, as specified on this document ation page. It should look something like this:

Find_package (Catkin REQUIRED components foo_msgs)

add_dependencies (Your_program ${catkin_exported_targets})
add_dependencies (your_library ${catkin_exported_targets})
Link Comments

You are should check that ' ${catkin_exported_targets} ' are set to something before passing it to ' add_dependencies (...) `. William (Aug)

https://gist.github.com/wjwwood-snippets/5979727 William (Aug)

doesn ' t The fix for this issue make this check redundant? https://github.com/ros/catkin/issues/453 Kalakris (Aug)

Ah Yes, I forgot we added that. William (Aug '2)

The documentation link above is broken. The page can be found here. Neil Traft (Aug 8 ') add a comment 2

answered a kruset
7313 Bayi

Updated Feb 7 '

Catkin_make with a argument just passes that argument to make. That's a make target for the package E

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.