rclpy icon indicating copy to clipboard operation
rclpy copied to clipboard

Remove `SHARED` from `pybind11_add_module`

Open wolfv opened this issue 1 year ago • 6 comments
trafficstars

When the module is compiled with MODULE (the default), the proper linker flags are added on macOS (specifically -undefined dynamic_lookup). Otherwise, rclpy segfaults when linked on conda.

Is the SHARED really necessary? The pybind11 documentation says:

Specifying SHARED will create a more traditional dynamic library which can also be linked from elsewhere.

Is anyone linking against this library as a "traditional dynamic library"?

wolfv avatar Jun 20 '24 19:06 wolfv

Seems like a reasonable change to me.

Is anyone linking against this library as a "traditional dynamic library"?

I'm not sure. Let's find out!

CI (repos file build: --packages-above-and-dependencies rclpy test: --packages-above rclpy)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

sloretz avatar Jun 20 '24 20:06 sloretz

I guess that means .. it works?! :)

wolfv avatar Jun 20 '24 21:06 wolfv

If I understand the CI correctly, then something went wrong in a package on Windows? Do you think that's related to this change?

wolfv avatar Jun 21 '24 06:06 wolfv

If I understand the CI correctly, then something went wrong in a package on Windows? Do you think that's related to this change?

Unclear. It may be, because we don't see that same failure in the nightly builds: https://ci.ros2.org/view/nightly/job/nightly_win_rel/3083/

clalancette avatar Jun 21 '24 12:06 clalancette

Damnation.

wolfv avatar Jun 21 '24 13:06 wolfv

I would be happy to make this conditional (keep the current one on Windows). I don't really think that it should change anything though.

wolfv avatar Jun 21 '24 14:06 wolfv

@Mergifyio rebase

fujitatomoya avatar Feb 27 '25 16:02 fujitatomoya

rebase

✅ Branch has been successfully rebased

mergify[bot] avatar Feb 27 '25 16:02 mergify[bot]

Pulls: ros2/rclpy#1305 Gist: https://gist.githubusercontent.com/fujitatomoya/f3edff6e70e07b92b751acd2dc92783e/raw/1f035dde991304b202c0027dce36b57e2315302c/ros2.repos BUILD args: --packages-above-and-dependencies rclpy TEST args: --packages-above rclpy ROS Distro: rolling Job: ci_launcher ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15253

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

fujitatomoya avatar Feb 27 '25 16:02 fujitatomoya

Great, now Windows CI seems to be happy, together with all other builds.

traversaro avatar Feb 28 '25 08:02 traversaro

Thanks!

traversaro avatar Feb 28 '25 09:02 traversaro

do we need to backport this to jazzy ?

ahcorde avatar Feb 28 '25 09:02 ahcorde

do we need to backport this to jazzy ?

That would permit to fix the macos crashes on conda-forge on vanilla build from sources. On robostack we have a patch for this on both jazzy and humble so we do not strictly need to backport this, but it is beneficial for someone build stock ROS 2 without patches.

traversaro avatar Feb 28 '25 09:02 traversaro

I also propagate this changes on other ros2 repos that were affected by this problem:

  • https://github.com/ros2/rosbag2/pull/1929
  • https://github.com/ros2/ros2_tracing/pull/154
  • https://github.com/ros2/netperf/pull/2

traversaro avatar Feb 28 '25 09:02 traversaro

https://github.com/Mergifyio backport jazzy humble

ahcorde avatar Mar 03 '25 08:03 ahcorde

backport jazzy humble

✅ Backports have been created

mergify[bot] avatar Mar 03 '25 08:03 mergify[bot]