-
Notifications
You must be signed in to change notification settings - Fork 101
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
find_library: Prefer currently loaded libraries over searching LD_LIBRARY_PATH
#143
Comments
Here is a working prototype on Linux: Cribbing from Drake source: |
At this commit for this Bazel repro project, I can now either specify the RMW implementation at linking time, or defer to environment variables: @dirk-thomas I would find this extremely useful. Can I ask what (if any) evidence might sway you to consider this? :D |
Since the goal of having a distro is to ensure stability backports are for bug fixes only. Enhancements should target the next distro. The first test packages of Dashing are targeted to be available in the first week of April. |
Aye, sounds good. Will await the merge of ros2/rcpputils#3, and then file this against the dev branch. Thanks! |
We have a ros2 node that needs capabilities set via
If I understand correctly, the proposal by @EricCousineau-TRI would solve this problem. Any chance to get this functionality in the next release? Or any suggestions for a workaround? |
@EricCousineau-TRI are you planning to iterate on this? |
@wieset How would it solve the problem if the library you are trying to find / load isn't already loaded? |
@ivanpauno Probably not anytime in the near future (~6mo to 1yr), unfortunately :( |
@dirk-thomas I looked at @EricCousineau-TRI's example code and you are right, it would not solve my problem if the library isn't already loaded. I guess I could link it at build time so that it gets loaded at program startup? However, to preserve loading at run time, I see two options: Either |
@wieset Customizing your build to use rpath for this use case sounds like the way to go. |
@dirk-thomas Agreed, and I am already using |
You are right. I missed the context on this ticket. I wonder if it makes sense to introduce a separate environment variable for this or if you should just make sure when running executables as root to set the existing environment variables yourself explicitly. |
As far as I understand, |
Not sure if introducing a new env var like Please feel free to propose PRs to add this enhancement (as indicated by the "help wanted" label). |
Will look into into it! |
Created a pull request at ros2/rcpputils#44 |
FWIW @hidmic, @IanTheEngineer, and I are starting to discuss this with other folk at TRI. First towards our internal uses, then towards integration with things like Drake. |
Hmm, I'm starting to wonder why we need |
Indeed we can. Thanks for the bump! |
Thanks a lot @hidmic, I think this gets me halfway there. |
At present,
find_library
drops straight into searching libraries alongLD_LIBRARY_PATH
, rather than first querying loaded libraries. One of the 3 current implementations:https://github.com/ros2/rmw_implementation/blob/32c3de1/rmw_implementation/src/functions.cpp#L77
It'd be nice if this code instead preferred currently loaded libraries, to support application code that don't want the ability to switch DDS implementations (e.g. simplifying repro cases, etc.) at runtime, and instead RPATH link the appropriate libraries.
The text was updated successfully, but these errors were encountered: