ros2 / ros2/rosidl_python

Custom message don't compile with -Wl,--no-undefined

Open
#213 4 comments 0 reactions 1 assignee View on GitHub

@mjcarroll is already working on this.

Since Apr 3, 2025.

Dominant language
EmberScript
Stars
26
Forks
68
Avg merge
2d 13h
Merged PRs (30d)
1

Description

Bug report

Required Info:

  • Operating System:
    Ubuntu 24.04
  • Installation type: binaries
  • Version or commit hash: 4.6.2-1noble.20240513.234614
  • DDS implementation: default
  • Client library (if applicable): N/A
Steps to reproduce issue
docker run -it ros:jazzy
cd && mkdir src && cd src
git clone https://github.com/Rayman/tutorial_interfaces.git
cd
colcon build
Expected behavior

Custom messages will compile with -Wl,--no-undefined linker flag.

Actual behavior
Starting >>> tutorial_interfaces
--- stderr: tutorial_interfaces                              
/usr/bin/ld: CMakeFiles/tutorial_interfaces_s__rosidl_typesupport_introspection_c.dir/rosidl_generator_py/tutorial_interfaces/_tutorial_interfaces_s.ep.rosidl_typesupport_introspection_c.c.o: in function `Py_XDECREF':
_tutorial_interfaces_s.ep.rosidl_typesupport_introspection_c.c:(.text+0x5a): undefined reference to `_Py_Dealloc'
/usr/bin/ld: CMakeFiles/tutorial_interfaces_s__rosidl_typesupport_introspection_c.dir/rosidl_generator_py/tutorial_interfaces/_tutorial_interfaces_s.ep.rosidl_typesupport_introspection_c.c.o: in function `_register_msg_type__msg__num':
_tutorial_interfaces_s.ep.rosidl_typesupport_introspection_c.c:(.text+0xc7): undefined reference to `PyCapsule_New'
...
Additional information

These errors indicate that the generated interfaces are not linked correctly to Python3. The solution would be to adjust the cmake files that the generated python interfaces are correctly linked.

I hope I'm filing this bug in the correct repo. If not, please point me in the right direction.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.