-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
libobs: Use RTLD_NOW to load modules #12575
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
Conversation
Since |
Edit: But |
This is currently expected and matches Windows. A proper notification (on all platforms) would be nice but is out-of-scope for this PR. |
Potentially dumb question, but is the Qt 5 check even needed with |
On Linux outside of our Flatpak (e.g. Ubuntu), you can end up with Qt 5 and 6 installed side by side. |
While |
RTLD_LAZY means that symbols will only be resolved when first used, while RTLD_NOW tries to resolve them immediately. This means that if there are missing symbols (e.g, because a function got removed from libobs), dlopen with RTLD_LAZY will happily open that module but we get a runtime crash when the module tries to use that symbol, while with RTLD_NOW we instead get a (nicer) error on dlopen.
@tytan652 I've changed |
The suffix check is mainly meant for |
We had actually planned to remove the Qt 5 check for this release, and may still before RC/stable. It was put into place around OBS Studio 28 three years ago for the transition from Qt 5 to Qt 6. We expect that the number of users still having Qt5-based OBS Studio plugins should be incredibly small. cc @kkartaltepe |
Should I just undo the changes made to the Linux Qt 5 check here then? |
Context, we used to always use only |
As mentioned above, using
So for any binary built with the macOS 12 deployment target (which plugins won't all be) the effect will be the same as if
|
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.
macOS changes should be fine, Linux changes probably as well but defer to Linux maintainers to approve that.
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.
Tested on my machine
We can just leave it in, and deal with it in the revert/removal. |
Description
RTLD_LAZY means that symbols will only be resolved when first used, while RTLD_NOW tries to resolve them immediately. This means that if there are missing symbols (e.g, because a function got removed from libobs), dlopen with RTLD_LAZY will happily open that module but we get a runtime crash when the module tries to use that symbol, while with RTLD_NOW we instead get a (nicer) error on dlopen.
Motivation and Context
Crashes like the #12565 are annoying. It'd be nicer if we didn't load broken plugins in the first place.
Fixes #12565
How Has This Been Tested?
Tested on macOS 26. Testing from Linux contributors would be appreciated.
Tested with 0.9.4 of the audio-monitor plugin which still uses
obs_frontend_add_dock
.Prior to this PR, we get a crash on startup (not ideal).
With this PR, the plugin fails to load, and we get an error message in the log:
Types of changes
Checklist: