Skip to content

Fix multiple dependency descriptor generation#561

Open
caguero wants to merge 4 commits intomainfrom
caguero/multi_dep_msg_generation
Open

Fix multiple dependency descriptor generation#561
caguero wants to merge 4 commits intomainfrom
caguero/multi_dep_msg_generation

Conversation

@caguero
Copy link
Collaborator

@caguero caguero commented Feb 25, 2026

🦟 Bug fix

Our current code has an issue that only external consumers generating custom messages (with more than one dependency) will trigger it.

The core issue is in this loop:

foreach(dep ${generate_messages_DEPENDENCY_DESCRIPTIONS})
    list(APPEND ARGS --descriptor_set_in="${msgs_desc_file}")
  endforeach()

It should be:

foreach(dep ${generate_messages_DEPENDENCY_DESCRIPTIONS})
    list(APPEND ARGS --descriptor_set_in="${dep}")
  endforeach()

The fix has been combined with the ability to pass more than one message dependency and use colon or semicolon delimiters depending on the system.

For testing I modified the example to trigger the issue without this fix. You should be able to run the updated generating_custom_messages example.

Summary

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the fix (as needed)
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Remove this if GenAI was not used.

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

Backports: If this is a backport, please use Rebase and Merge instead.

Signed-off-by: Carlos Aguero <caguero@osrfoundation.org>
Copy link

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the following error when trying to build the example

${_IMPORT_PREFIX}/share/gz/protos/msgs.gz_desc: No such file or directory
Failed to execute protoc compiler: Command '['/opt/homebrew/bin/protoc-34.0.0', '--proto_path=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/proto2', '--descriptor_set_in=${_IMPORT_PREFIX}/share/gz/protos/msgs.gz_desc', '--plugin=protoc-gen-gzmsgs=/Users/addisuzt/ws/rotary/install//bin/gz-msgs_protoc_plugin', '--cpp_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg', '--gzmsgs_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg', '--python_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg/python/', '/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/proto2/gz/custom_msgs2/qux.proto']' returned non-zero exit status 1.
make[2]: *** [generating_custom_messages-msgs2_genmsg/gz/custom_msgs2/qux.pb.h] Error 255
make[1]: *** [CMakeFiles/generating_custom_messages-msgs2.dir/all] Error 2
make: *** [all] Error 2

Also, would it be possible to turn the example into a test? As it stands, I don't know which test fails without the change in this PR.

@caguero
Copy link
Collaborator Author

caguero commented Mar 11, 2026

I got the following error when trying to build the example

${_IMPORT_PREFIX}/share/gz/protos/msgs.gz_desc: No such file or directory
Failed to execute protoc compiler: Command '['/opt/homebrew/bin/protoc-34.0.0', '--proto_path=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/proto2', '--descriptor_set_in=${_IMPORT_PREFIX}/share/gz/protos/msgs.gz_desc', '--plugin=protoc-gen-gzmsgs=/Users/addisuzt/ws/rotary/install//bin/gz-msgs_protoc_plugin', '--cpp_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg', '--gzmsgs_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg', '--python_out=/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/build/generating_custom_messages-msgs2_genmsg/python/', '/Users/addisuzt/ws/rotary/src/gz-msgs/examples/generating_custom_msgs/proto2/gz/custom_msgs2/qux.proto']' returned non-zero exit status 1.
make[2]: *** [generating_custom_messages-msgs2_genmsg/gz/custom_msgs2/qux.pb.h] Error 255
make[1]: *** [CMakeFiles/generating_custom_messages-msgs2.dir/all] Error 2
make: *** [all] Error 2

I cannot reproduce this issue. Do you have any other gz-msg version installed in the system by any chance? Because the error looks like the type of error you'd get without this patch.

@azeey
Copy link

azeey commented Mar 12, 2026

Well, I can't seem to reproduce it myself either. It's possible that I had another version of gz-msgs built in the same colcon workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants