Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RMW_LIBRARY_PATH define in presence of transitions #446

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lalten
Copy link
Contributor

@lalten lalten commented Feb 25, 2025

This fixes the below error

unknown file: Failure
C++ exception with description "Failed to deserialize ROS message.: failed to load shared library 'external/ros2_rmw_cyclonedds/librmw_cyclonedds.so' due to dlopen error: external/ros2_rmw_cyclonedds/librmw_cyclonedds.so: cannot open shared object file: No such file or directory, at external/ros2_rcutils/src/shared_library.c:96, at external/ros2_rmw_implementation/rmw_implementation/src/functions.cpp:90" thrown in the test body.

Which you will get when transitions (e.g. via with_cfg.bzl) are at play, because the k8-fastbuild and friends will not be correct anymore, it has to be k8-fastbuild-ST-61f4e3852c4b or similar, depending on configuration.

Using ../ instead is always correct because of the runfiles structure at runtime.

@mvukov
Copy link
Owner

mvukov commented Feb 26, 2025

rootpath shouldn't have k8-fastbuild in it AFAIK.

We touched this in

I'd like to learn more about your usecase.

BTW, do you patch rmw_implementation with_cfg.bzl locally?

@lalten
Copy link
Contributor Author

lalten commented Mar 1, 2025

I added a failing test in ca7da17:
https://github.com/mvukov/rules_ros2/actions/runs/13606301154/job/38038169533?pr=446#step:5:61
image

and fixed it by using ../ instead of $(rootpath in 00f4065

name = "with_cfg.bzl",
sha256 = "d83f99ac39cd9940848ea11a51a60159cf09cda2ba30545036041551aae73ab4",
strip_prefix = "with_cfg.bzl-0.6.1",
url = "https://github.com/fmeum/with_cfg.bzl/releases/download/v0.6.1/with_cfg.bzl-v0.6.1.tar.gz",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes this isn't the latest release, but newer ones seem to cause issues with struct members of @bazel_features not being available when building in Workspace mode

@mvukov
Copy link
Owner

mvukov commented Mar 5, 2025

Would --nolegacy_external_runfiles help in the first place (mentioned in #65 )? (that is a recommended flag, we should have it in .bazelrc eventually) . With that flag I think we should just get ../ros2_rmw_cyclonedds/librmw_cyclonedds.so.

@lalten
Copy link
Contributor Author

lalten commented Mar 6, 2025

Would --nolegacy_external_runfiles help in the first place (mentioned in #65 )? (that is a recommended flag, we should have it in .bazelrc eventually) . With that flag I think we should just get ../ros2_rmw_cyclonedds/librmw_cyclonedds.so.

True, this does indeed help. But requiring this to be set is a hard sell to downstream consumers who may have a lot of migration work ahead of them to support this flag being flipped -- especially when just using ../ also makes this work regardless of --(no)legacy_external_runfiles

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