-
Notifications
You must be signed in to change notification settings - Fork 20
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
Load global symbols #30
Conversation
Just as a curiosity, which version of dlfcn-win32 is used in the CI ? vcpkg has 1.1.1 while conda-forge has 1.2.0, and the 1.2.0 had some changes w.r.t. 1.1.1 related also to the RTLD_GLOBAL flag (see dlfcn-win32/dlfcn-win32#44). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be feasible to write a test case that fails without this PR?
Codecov Report
@@ Coverage Diff @@
## main #30 +/- ##
==========================================
- Coverage 99.82% 99.48% -0.34%
==========================================
Files 15 15
Lines 584 587 +3
==========================================
+ Hits 583 584 +1
- Misses 1 3 +2
Continue to review full report at Codecov.
|
c804ef4
to
1b70d52
Compare
Thinking a little bit more about this I think this should target |
I agree that |
If you peeps are certain that this change is needed to get |
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
bb4eb14
to
a8160b2
Compare
Retargeted to |
friendly ping @mjcarroll and @chapulina |
That's a question for @j-rivero |
@@ -136,8 +134,6 @@ TEST(EnablePluginFromThis, LibraryManagement) | |||
} | |||
|
|||
EXPECT_TRUE(weak.IsExpired()); | |||
|
|||
CHECK_FOR_LIBRARY(libraryPath, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these checks are here to make sure the library is unloaded correctly. But @mxgrey's comment on the function suggests that it may not be reliable, so that could explain why you had to remove these. What do you think @mxgrey , should we remove the false checks, or adjust the CHECK_FOR_LIBRARY
function somehow?
} | ||
|
||
///////////////////////////////////////////////// | ||
TEST(Loader, LoadBadPlugins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a reason to move this test down here? Was it failing above?
@@ -368,7 +368,7 @@ namespace ignition | |||
#endif | |||
|
|||
void *dlHandle = dlopen(_pathToLibrary.c_str(), | |||
RTLD_NOLOAD | RTLD_LAZY | RTLD_LOCAL); | |||
RTLD_NOLOAD | RTLD_LAZY | RTLD_GLOBAL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think, @mxgrey , are we trying to do something that ign-plugin
wasn't meant to do, or is this a reasonable change?
See gazebosim/gz-sensors#38 (comment) for the reason why this change is needed.
Uhm. We are using tarball in the ign-plugin build, I can not find the version on the code. The date of the tarball is Nov 2017, probably 1.1.1? |
I talked to @mxgrey and he had the nice suggestion of adding a flag to enable the new behaviour. If we do this, we may not need to bump the version and only enable the new behaviour for the libraries that need it. Then I started looking more closely and noticed that the |
Adding a flag required to keep the two functionalities at the same time but the idea it's to keep just one way to load libraries (remove the code in ign-common if I remember correctly). The function I not really sure about how this could help the different libraries (ign-sensors, ign-gui, ign-rendering or ign-gazebo). But the idea it's to use |
Thanks! I am asking as in the journey to get a reliable working Gazebo with vcpkg-installed dependencies I became the dlfcn-win32 maintainer, even if I am definitively not an expert of Windows shared library interface. However, several users over time contributed quite a lot to the library. In particular in the release 1.2.0 that came out in 2019 (https://github.com/dlfcn-win32/dlfcn-win32/releases/tag/v1.2.0) there have been some works on loading of global symbols (see dlfcn-win32/dlfcn-win32#44). I would expect for everything to work fine for both dlfcn-win32 1.1.1 and 1.2.0, but with this tricky issues problems can always emerge. Actually I already wrote most of this in the original comment ( #30 (comment) ), but I forgot about that, sorry for the noise. : ) |
Removing beta label, we won't have time to wrap this up before code freeze. Let's retarget at Ignition-F. |
This isn't necessary anymore as we solved the |
This is the basic PR to make use of
ign-plugin
in other libraries.This comment in this other PR gazebosim/gz-sensors#38 (comment) explains what is going on. Basically some libraries pre-load some symbols of other libraries (for example
libignition-gazebo4-sensors-system.so
pre-load some ign-sensor symbols) and when you need to load some of the ign-sensor libraries you can't access these symbols because it was load previously.Using
RTLD_GLOBAL
we can access theses symbols but we should filter in all the libraries and look for the right one.Signed-off-by: ahcorde ahcorde@gmail.com