-
Notifications
You must be signed in to change notification settings - Fork 164
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
Linux: can you trust uname() to find out which version to load from a bundle? #115
Comments
we have such multiple locations check for Windows with Arm64EC and x64... where a Arm64EC host could load Arm64EC and x64 plugin binaries.. |
Unfortunately my knowledge about the internals of Linux are enough to tell that there's a problem here, but insufficient to confidently propose a solution that is both future-proof and backward compatible. At the end of the day, the information returned by The problem is that this makefile variable can have a lot of different values (someone on StackOverflow dug up a few), and I have no idea which is compatible with which, if any. And to make things worse, future versions of the kernel may drop some of these values or introduce new ones. My best bet would be an algorithm like this, but this would only solve the 64 bit vs. 32 bit case:
I'm not sure if similar problems can occur between 64 bit architectures, and if yes, how to resolve them. :-( |
When a 32 bit host application is running with a 64 bit Linux kernel, then getCurrentMachineName will return "x86_64", but dlopen will fail with "wrong ELF class: ELFCLASS64". When this happens, our best bet might be to try loading the plugin from "i686-linux" and "i386-linux". See: steinbergmedia/vst3sdk#115
I made a PR from the proposed solution: steinbergmedia/vst3_public_sdk#57 I compiled the validator application for 32 bits, and sucessfully validated my plugin bundle with it on a 64 bit Linux. |
Reproduction
I have compiled my VST 3 synth plugin for 32 bit Linux, and installed it as an
i686
-only bundle like this:I ran a VST plugin scan in the Linux
i686
version of Reaper 6.80, but on anx86_64
Ubuntu 20.04 system.Expected Result
The plugin is found and loaded by the host.
Actual Result
js80p.vst3
file format, then the plugin can be successfully loaded by the 32 bit version of Reaper on a 64 bit Linux system.Sure, but where exactly is this an SDK issue rather than a bug in Reaper?
As can be seen from the output of
strace -f -s 128 --abbrev=none ./REAPER/reaper
below, the problem occurs when Reaper callsuname()
, conforming to what the specs say (see VST3::Hosting::getCurrentMachineName()):uname()
will report the current kernel's architecture, but that's not necessarily the same as the architecture of the calling application, and the two are not necessarily compatible with each other in both directions.Note that Reaper won't even try looking for
x86_64-linux/js80p.so
, probably because it detects that it won't be able to load a plugin with that architecture, so it falls back tounknown-linux
. (This fallback is probably specific to Reaper, since the SDK doesn't seem to contain code like this.)Long story short: an
i686
host that is usinguname()
to figure out which plugin architecture to load from a bundle, will never findi686-linux
when running on a system with anx86_64
kernel.Solution?
I think
public.sdk/source/vst/hosting/module_linux.cpp
could use a compile-time assembled fallback list of compatible platform names, similarly topublic.sdk/source/vst/hosting/module_win32.cpp
. However, since there are a lot of possiblexxx-linux
combinations, I'm not sure how could such an approach be both backward-compatible with existing hosts and plugins, and future-proof and robust at the same time. A change like this could potentially introduce a lot of bugs with existing plugins and hosts.Maybe it would be more safe to just mention this 64 bit kernel vs. 32 bit host application corner case in the documentation as a known issue, and keep the current
uname()
based logic unchanged?The text was updated successfully, but these errors were encountered: