Comments (22)
Hmm, I'm starting to wonder why we need rcpputils::find_library_path()
to begin with. If we simply provide rcutils_load_shared_library()
or its rcpputils::SharedLibrary
wrapper with a relative path, dlopen
and LoadLibrary
will search paths and yield loaded object files. Documentation for both suggests that already loaded object files will not be pulled in again. By doing this, RPATHs, LD_LIBRARY_PATHs, RUNPATHs, PATHs, and preloaded libraries would be honored by default.
CC @EricCousineau-TRI @wieset @clalancette.
from rcutils.
@ivanpauno Probably not anytime in the near future (~6mo to 1yr), unfortunately :(
from rcutils.
Created a pull request at ros2/rcpputils#44
from rcutils.
Indeed we can. Thanks for the bump!
from rcutils.
Here is a working prototype on Linux:
EricCousineau-TRI/rcpputils@b66a3d9
Cribbing from Drake source:
https://github.com/RobotLocomotion/drake/blob/4c6246197/common/find_loaded_library.cc
from rcutils.
At this commit for this Bazel repro project, I can now either specify the RMW implementation at linking time, or defer to environment variables:
EricCousineau-TRI/repro@cea1102
@dirk-thomas I would find this extremely useful. Can I ask what (if any) evidence might sway you to consider this? :D
from rcutils.
Can I ask what (if any) evidence might sway you to consider this?
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.
from rcutils.
Aye, sounds good. Will await the merge of ros2/rcpputils#3, and then file this against the dev branch. Thanks!
from rcutils.
We have a ros2 node that needs capabilities set via setcap
which leads to LD_LIBRARY_PATH
being omitted during execution. So we are setting RPATH
in the binary to find shared libraries. However, as find_library_path
relies on LD_LIBRARY_PATH
the node fails with
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
what(): failed to initialized rcl init options: failed to find shared library of rmw implementation. Searched rmw_fastrtps_cpp, at /tmp/binarydeb/ros-eloquent-rmw-implementation-0.8.2/src/functions.cpp:130, at /tmp/binarydeb/ros-eloquent-rcl-0.8.3/src/rcl/init_options.c:55
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?
from rcutils.
@EricCousineau-TRI are you planning to iterate on this?
from rcutils.
If I understand correctly, the proposal by @EricCousineau-TRI would solve this problem.
@wieset How would it solve the problem if the library you are trying to find / load isn't already loaded?
from rcutils.
@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 RPATH
would have to be searched, which I can set through CMAKE_INSTALL_RPATH
, or another environment variable could be used instead of LD_LIBRARY_PATH
, e.g. RMW_LIBRARY_PATH
. I mentioned both those options in ros2/rcpputils#40.
from rcutils.
@wieset Customizing your build to use rpath for this use case sounds like the way to go.
from rcutils.
@dirk-thomas Agreed, and I am already using RPATH
to load all other libraries. But that doesn't get me around the fact that find_library_path()
for the rmw library currently doesn't look there. Or am I missing something?
from rcutils.
But that doesn't get me around the fact that
find_library_path()
for the rtw library currently doesn't look there.
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.
from rcutils.
As far as I understand, LD_LIBRARY_PATH
is ignored completely for setcap
/ setuid
executables, so setting it myself wouldn't help unfortunately. See http://man7.org/linux/man-pages/man8/ld.so.8.html
from rcutils.
Not sure if introducing a new env var like ROS_LIBRARY_PATH
to bypass that security limitation is a good idea. ld
only wouldn't filter that because it doesn't know about it and it ignores LD_LIBRARY_PATH
due to security considerations.
Please feel free to propose PRs to add this enhancement (as indicated by the "help wanted" label).
from rcutils.
Will look into into it!
from rcutils.
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.
from rcutils.
Alright, see #320 and connected PRs for a first stab at this. @wieset this should (indirectly) solve your issues as well. These changes render rcpputils::find_library_path
obsolete though (for usage in core packages).
from rcutils.
@hidmic Now that we've landed #320 and friends, can we close this out?
from rcutils.
Thanks a lot @hidmic, I think this gets me halfway there. RUNPATH
still needs to get populated properly. I'll continue the discussion with @clalancette in ros2/rcpputils#44.
from rcutils.
Related Issues (20)
- 👩🌾 test_logging_long_messages failing on Dashing HOT 1
- Arch Linux: Compilation error with rcutils in ros2 HOT 5
- cmake warning on OSX: No known linker flag to force library linkage HOT 1
- Warnings while compiling to WebAssembly HOT 2
- error: rcutils/logging_macros.h: No such file or directory HOT 1
- New warning in the packaging linux jobs HOT 3
- logging_macros.h not found HOT 1
- Why does `rcutils_expand_user` fail on non-existent directory? HOT 2
- High logging overhead HOT 5
- AddressSanitizer: new-delete-type-mismatch in rcutils_string_map_fini HOT 3
- Human Readable time in logs HOT 12
- "Failed to find exported target names" error while colcon build HOT 3
- Undefined symbol: rcutils_log_internal HOT 2
- Make logging functionality truly thread-safe HOT 3
- performance_test_fixture not found HOT 4
- Valgrind shows leak in rcutils_load_shared_library HOT 1
- Superfluous `va_copy` call in `rcutils_char_array_vsprintf` HOT 2
- Test failure on nightly_linux_address_sanitizer
- Consol formating ignores escape sequences HOT 4
- Setting/relying on _GNU_SOURCE seems incorrect HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcutils.