Skip to content

Fix backward ros when using component node and macos - #53

Closed
mini-1235 wants to merge 3 commits into
RoboStack:mainfrom
mini-1235:fix/backward_ros
Closed

mini-1235 wants to merge 3 commits into
RoboStack:mainfrom
mini-1235:fix/backward_ros

Conversation

@mini-1235

Copy link
Copy Markdown
Contributor
Platform Example Installed (ros-rolling) After this PR
macOS Ordinary node Crashes; no backtrace Backtrace with function names, no source lines
macOS Component Crashes; no backtrace Backtrace showing the timer callback, no source lines
Linux Ordinary node Backtrace with crash_node.cpp:8 and a source snippet Backtrace with crash_node.cpp:8 and a source snippet
Linux Component Crashes; no backtrace Backtrace with crash_component.cpp:12 and a source snippet

This PR fixes two things:

  • Previously component mode does not work in any platform when using backward ros, as reported in building with backward ros ros2/rclcpp#2396
  • Previously using backward ros would not have a backtrace when the node crashes

mini-1235 and others added 3 commits September 26, 2026 14:00
Signed-off-by: Maurice <mauricepurnawan@gmail.com>
Only executables and SHARED libraries (e.g. rclcpp components) need
libbackward forced in. Linking it into MODULE targets such as pybind11
extensions made importing them replace Python's faulthandler output.

Also drop the CI cache for backward-ros so the patch is actually rebuilt
(temporary, remove before merge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Maurice <mauricepurnawan@gmail.com>
vinca skips recipes already published on robostack-rolling with the
same build number, so the patch change was never built in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Maurice <mauricepurnawan@gmail.com>
@mini-1235

Copy link
Copy Markdown
Contributor Author

@traversaro Oops, sorry — I actually meant to ask you to take a look at this one as well, but I accidentally left the comment on the wrong PR :(

+# libbackward (e.g. component_container) then pulls it in and installs the handler.
+# MODULE targets (Python extensions) are left alone so importing them does not
+# replace the interpreter's own crash handling.
+SET(CMAKE_SHARED_LINKER_FLAGS "${backward_ros_link_flags} ${CMAKE_SHARED_LINKER_FLAGS}")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thinking more about this today, and based on what we learned from #51, this approach seems potentially quite dangerous. Maybe we should propose a target-based backward_ros instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Indeed, I would say that is not a great idea in general. Unfortunately, not linking any target seems to be exactly how the library is meant to be integrated, see the README https://github.com/pal-robotics/backward_ros#integration-of-backward_ros and https://github.com/pal-robotics/backward_ros/blob/3c71c9f184223f885459ad67a223eb36a5ca347f/cmake/BackwardConfigAment.cmake#L27 . That combined with the fact that I imagine this library is used also as a transitive dependency (so its global effect may appear even if the project does not directly call find_package(backward_ros)) make its use really confusing, but I guess there is not a lot we can do as downstream packagers on this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What if I limit the changes here to just fixing macOS? Would you agree with that part? I can remove the CMAKE_SHARED_LINKER_FLAGS change here and propose the target-based design upstream instead.

@mini-1235

Copy link
Copy Markdown
Contributor Author

Oh, I think macOS should already work in non-component mode after #51 is merged. I never actually tested the two together though. Sorry for the noise here!

@mini-1235 mini-1235 closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants