Spacechild1 / vstplugin

VST plugin support for Pd and SuperCollider (mirror of https://git.iem.at/pd/vstplugin). If possible, use the issue tracker at https://git.iem.at/pd/vstplugin/-/issues.
Other
84 stars 6 forks source link

Unable to use VST3 plugins in Aarch64 #12

Closed escuta closed 1 year ago

escuta commented 1 year ago

Hi Christof, if you're there,

I managed to build BinauralDecoder.vst3 on the Aarch64/Pi and testing the plugin in Ardour, it seems to be working, although I didn't test with audio. I also downloaded a few other VST3 packages to test. Thus far, I've not been able to get any to scan properly with VSTPlugin.search. All of the package plugins in /usr/lib/vst3 and the BinauralDecoder.vst3 plugin installed in ~/.vst3 give the following type of error:

ERROR: couldn't load '/usr/lib/vst3/sfizz.vst3': bundle doesn't contain any plugins

I tried moving the ~/.vst3 to /usr/lib/vst3 and it gives the same response:

I've been trying to do things with ldconfig but so far to no avail.

I built vstplugin using the the develop branch and configured with:

cmake .. -DSUPERNOVA=true -DPD=OFF -DVST2=OFF -DSC_INCLUDEDIR=/home/iain/git/supercollider

Thanks!

Spacechild1 commented 1 year ago

Hi, I have never actually tested VST3 plugins on Linux aarch64 platforms. Can you attach sfizz.vst3 and BinauralDecoder.vst3, so I can have a look at the bundle structure?

Spacechild1 commented 1 year ago

Also, what do you get when you do uname -m in your terminal?

escuta commented 1 year ago

sfizz.vst3.zip

Thanks! - please see the zip attached. uname -m gives: aarch64

escuta commented 1 year ago

Please ignore the BinauralDecoder i just sent, I had modified it - so deleted. Will send again the real thing..

Spacechild1 commented 1 year ago

Thanks, but the sfizz.vst3 version you have posted is an x86_64 binary...

escuta commented 1 year ago

Thanks, but the sfizz.vst3 version you have posted is an x86_64 binary...

oh, sorry, getting tired - just a minute. Will send the BinauralDecoder too

escuta commented 1 year ago

Here they are. The BinauralDecoder was originally saved in the ~/.vst3 directory within the IEM directory. IEM.zip sfizz.vst3.zip

Spacechild1 commented 1 year ago

Ah, that's an issue with my code. Can you try the arm_linux branch? https://git.iem.at/pd/vstplugin/-/tree/arm_linux

escuta commented 1 year ago

Thanks. Here's the result of VSTPlugin.search:

-> VSTPlugin
searching in '/home/iain/.vst3'...
probing /home/iain/.vst3/IEM/BinauralDecoder.vst3... unexpected error! (uncaught exception)
found 0 plugins
searching in '/usr/lib/vst3'...
ERROR: couldn't load '/usr/lib/vst3/master_me.vst3': bundle doesn't contain any plugins
probing /usr/lib/vst3/sfizz.vst3... couldn't load! libabsl_hash.so.2111.0.0: cannot open shared object file: No such file or directory
probing /usr/lib/vst3/IEM/BinauralDecoder.vst3... unexpected error! (uncaught exception)
probing /usr/lib/vst3/Odin2.vst3... unexpected error! (uncaught exception)
probing /usr/lib/vst3/Surge XT Effects.vst3... unexpected error! (uncaught exception)
probing /usr/lib/vst3/Surge XT.vst3... error! subprocess was terminated with signal 11 (Segmentation fault)
found 0 plugins
Spacechild1 commented 1 year ago

Interesting. And all of these plugins work in Ardour (aarch64)?

Can you try a few VST2 plugins as well? The Debian has a few packages: https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=all&keywords=vst+plugin. For example, try iem-plugin-suite-vst.

You need to build vstplugin with VST2 support, though. Just follow the instructions in the README.

Then I know whether the problem is specific to my VST3 implementation - or a general one.

escuta commented 1 year ago

In Ardour, BinauralDecoder.vst3 and Surge XT Effects (the VST3 as well as the LV2 vesrsions) work. sfizz.vst3 and master_me.vst3 produce errors and are not loaded (not able to copy the error message across, sorry, will try later).

OK, will try the VST2 plugins.

By the way, and sorry if I'm confused here, but it seems your changes to the file vst/Search.cpp are to the function getBundleBinaryPath() and this is only getting called in the ~/.vst path plugins and not /usr/lib/vst3. I put in a printf just before the final return to test the path.c_str() value. This from memory was correct, I think, and was "Contents/aarch64-linux".

Spacechild1 commented 1 year ago

sfizz.vst3 and master_me.vst3 produce errors and are not loaded (not able to copy the error message across, sorry, will try later).

Makes sense. vstplugin already tells you the actual error. (sfizz.vst3 can't find a shared library, master_me.vst3 is not an aarch64 plugin)

By the way, and sorry if I'm confused here, but it seems your changes to the file vst/Search.cpp are to the function getBundleBinaryPath()

This was the original fix, which was sufficient vor VST3 plugins. Then I realized that for VST3 plugins I also had to update gBundleBinaryPaths.

Spacechild1 commented 1 year ago

BTW, I just pushed a small change to arm_linux. It shouldn't change anything, but you never know...

escuta commented 1 year ago

When VST is enabled in the iempluginsuite build, it's installed in ~/.vst. eg. ~/.vst/IEM/libBinauralDecoder.so This doesn't get scanned by VSTPlugin.search (built with VST enabled). If I move the contents of ~/.vst to /usr/lib/vst it does. I only have the Binaural Decoder installed as VST (I'll try and find others and report back) but it gives the following error when searched by VSTPlugin:

searching in '/usr/lib/vst'... probing /usr/lib/vst/IEM/libBinauralDecoder.so... unexpected error! (uncaught exception) found 0 plugins

escuta commented 1 year ago

Installed the aarch64 package lsp-plugins which has a stack of vst. Much more positive looking response from VSTPlugin.search:

searching in '/usr/lib/vst'...
probing /usr/lib/vst/lsp-plugins/crossover-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/mb-gate-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/comp-delay-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-dyna-processor-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/noise-generator-x4.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-gate-lr.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-gate-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/mb-compressor-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/para-equalizer-x16-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-expander-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-expander-lr.so... ok!
probing /usr/lib/vst/lsp-plugins/compressor-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/graph-equalizer-x16-lr.so... ok!
probing /usr/lib/vst/lsp-plugins/profiler-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-mb-compressor-lr.so... ok!
probing /usr/lib/vst/IEM/libBinauralDecoder.so... unexpected error! (uncaught exception)
probing /usr/lib/vst/lsp-plugins/para-equalizer-x32-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/graph-equalizer-x16-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/dyna-processor-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/oscilloscope-x2.so... ok!
probing /usr/lib/vst/lsp-plugins/mb-gate-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-expander-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/mb-compressor-lr.so... ok!
probing /usr/lib/vst/lsp-plugins/expander-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/para-equalizer-x32-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/noise-generator-x1.so... ok!
probing /usr/lib/vst/lsp-plugins/latency-meter.so... ok!
probing /usr/lib/vst/lsp-plugins/expander-ms.so... ok!
probing /usr/lib/vst/lsp-plugins/oscillator-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-compressor-mono.so... ok!
probing /usr/lib/vst/lsp-plugins/oscilloscope-x1.so... ok!
probing /usr/lib/vst/lsp-plugins/sc-gate-stereo.so... ok!
probing /usr/lib/vst/lsp-plugins/limiter-mono.so... ok!
waiting for '/usr/lib/vst/lsp-plugins/trigger-midi-stereo.so'...
waiting for '/usr/lib/vst/lsp-plugins/multisampler-x48.so'...
waiting for '/usr/lib/vst/lsp-plugins/trigger-midi-mono.so'...
waiting for '/usr/lib/vst/lsp-plugins/impulse-responses-stereo.so'...

The waiting business occurs in Ardour too, for the same problematic plugins

EDIT. This waiting behaviour continues, by the way, and makes VSTPlugin completely stuck. Even trying to kill off sclang and all the servers didn't help. Need to reboot. Will remove all those VSTs. Does VSTPlugin.search have a timeout mechanism?

escuta commented 1 year ago

the libBinaurDecoder.so plugin doesn't work for me in Ardour because I'm doing X forwarding. I get a shared memory error: Xlib: extension "MIT-SHM" missing on display "localhost:10.0"

and the plugin is "Concealed"

The VST3 version, does seem to be working however in Ardour

Spacechild1 commented 1 year ago

This doesn't get scanned by VSTPlugin.search (built with VST enabled)

Are you sure? If VSTPlugin is built with VST2 support, it definitely scans the ~/.vst folder - but only if it exists!

Does VSTPlugin.search have a timeout mechanism?

Yes. Alternatively, you can exclude plugins from the search. Check the documentation of VSTPlugin.search.

I only have the Binaural Decoder installed as VST (I'll try and find others and report back)

IEM plugins are available as a Debian package (iem-plugin-suite-vst)

escuta commented 1 year ago

I've since tested the VST2 "helm-synth" with vstplugin and it works as expected, with sound

Are you sure? If VSTPlugin is built with VST2 support, it definitely scans the ~/.vst folder - but only if it exists!

yes, I have a ~/.vst directory and it has never been scanned.

escuta commented 1 year ago

IEM plugins are available as a Debian package (iem-plugin-suite-vst)

not for aarch64 unfortunately. I could build others though (beyond libBinauralDecoder.so) but will only be using BinauralDecoder for this project

escuta commented 1 year ago

I'm sorry Christof - ~/.vst does indeed get scanned. It gives the following error with libBinauralDecoder.so:

searching in '/home/iain/.vst'... probing /home/iain/.vst/IEM/libBinauralDecoder.so... unexpected error! (uncaught exception) found 0 plugins

Here is the complete scan report:

-> VSTPlugin
searching in '/home/iain/.vst'...
probing /home/iain/.vst/IEM/libBinauralDecoder.so... unexpected error! (uncaught exception)
found 0 plugins
searching in '/usr/lib/vst'...
probing /usr/lib/vst/amsynth_vst.so... ok!
probing /usr/lib/vst/helm-synth.so... ok!
probing /usr/lib/vst/IEM/libBinauralDecoder.so... unexpected error! (uncaught exception)
found 2 plugins
searching in '/home/iain/.vst3'...
probing /home/iain/.vst3/sfizz.vst3... couldn't load! libabsl_hash.so.2111.0.0: cannot open shared object file: No such file or directory
probing /home/iain/.vst3/IEM/BinauralDecoder.vst3... unexpected error! (uncaught exception)
found 0 plugins
searching in '/usr/lib/vst3'...
ERROR: couldn't load '/usr/lib/vst3/master_me.vst3': bundle doesn't contain any plugins
probing /usr/lib/vst3/sfizz.vst3... couldn't load! libabsl_hash.so.2111.0.0: cannot open shared object file: No such file or directory
probing /usr/lib/vst3/IEM/BinauralDecoder.vst3... unexpected error! (uncaught exception)
probing /usr/lib/vst3/Odin2.vst3... unexpected error! (uncaught exception)
probing /usr/lib/vst3/Surge XT Effects.vst3... error! subprocess was terminated with signal 11 (Segmentation fault)
probing /usr/lib/vst3/Surge XT.vst3... error! subprocess was terminated with signal 11 (Segmentation fault)
found 0 plugins
escuta commented 1 year ago

Trying in Pd, gives the same errors.

For BinauralDecoder.vst3:

probing '/home/iain/.vst3/IEM/BinauralDecoder.vst3' ... unexpected error! (uncaught exception) vstplugin~: cannot open 'BinauralDecoder.vst3'

And for libBinauralDecoder.so:

probing '/home/iain/.vst/IEM/libBinauralDecoder.so' ... unexpected error! (uncaught exception) vstplugin~: cannot open '/home/iain/.vst/IEM/libBinauralDecoder.so'

Spacechild1 commented 1 year ago

not for aarch64 unfortunately.

I see arm64 (= aarch64) packages: https://packages.debian.org/bullseye/iem-plugin-suite-vst Have you actually tried sudo apt-get install iem-plugin-suite-vst?


So the good news is that most VST2 plugins seem work. One the other hand, we have not yet found a single working VST3 plugin...

I currently don't have access to an aarch64 Linux system, so it's a bit hard for me to debug. If you have time and energy, it would be great if you could the following:

  1. build VSTPlugin with cmake .. -DCMAKE_BUILD_TYPE=Debug -DLOGLEVEL=3
  2. run the host app from the command line in a debugger:
    gdb --args <install_path>/VSTPlugin/plugins/host probe <plugin_path>
    > run
  3. copy the console output and save it
  4. a) if the host app crashes, get a backtrace with bt and save it. b) if the host app terminates with an unhandled exception, type catch throw before run. This will stop the program whenever an exception is thrown. If the exception is harmless, type continue to resume the program. Once you hit the offending exception, get a backtrace with bt and save it.
escuta commented 1 year ago

I see arm64 (= aarch64) packages: https://packages.debian.org/bullseye/iem-plugin-suite-vst Have you actually tried sudo apt-get install iem-plugin-suite-vst?

Arch doesn't have apt-get. On the x86_64 Arch machines there is a "iempluginsuite" package with all the VST3 plugins. This is installed with "sudo pacman -S iempluginsuite". I've not seen a package with the VST2 plugins. But will look again later. aarch64 doesn't have the IEM plugins packaged, as far as I know. That's why I needed to build on the Pi.

Sure, I'll do the tests you've asked for. It will be a big thing for me to be able to use BinauralDecoder on the Pi. It's for a specific project which up until now has been using 1st order binaural decoding. The higher orders (even 2nd) make a big difference!

I'll report back soon.

Spacechild1 commented 1 year ago

Arch doesn't have apt-get.

Ah, I just assumed you're running Debian (resp. Raspberry OS)

escuta commented 1 year ago

Not sure if I'm doing this right. I entered the following:

[iain@botanica vstplugin]$ gdb --args ~/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host ~/.vst3/
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host...
(gdb) run
Starting program: /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host /home/iain/.vst3/

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org 
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
usage:
  probe <plugin_path> [<id>] [<file_path>]
  bridge <pid> <shared_mem_path> <log_pipe>
  test <version>
  --version
[Inferior 1 (process 2827) exited with code 01]
(gdb)
escuta commented 1 year ago

Also tried the following with the same result:

gdb --args ~/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host ~/.vst3/IEM/BinauralDecoder.vst3/Contents/aarch64-linux/BinauralDecoder.so

Spacechild1 commented 1 year ago

Thanks! You just missed the probe verb. Also, for VST3 plugins, <plugin_path> refers to the .vst3 bundle, not the .so file.

escuta commented 1 year ago

Ah, so i did. OK. This is the result. An X problem?

[iain@botanica vstplugin]$ gdb --args ~/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host probe ~/.vst3/IEM/BinauralDecoder.vst3                     
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host...
(gdb) run
Starting program: /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host probe /home/iain/.vst3/IEM/BinauralDecoder.vst3

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org 
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
probing /home/iain/.vst3/IEM/BinauralDecoder.vst3 -1
[New Thread 0x7ff636f080 (LWP 2899)]
[New Thread 0x7ff59af080 (LWP 2900)]
[New Thread 0x7ff5139080 (LWP 2901)]
X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  130 (MIT-SHM)
  Minor opcode of failed request:  2 (X_ShmDetach)
  Serial number of failed request:  58
  Current serial number in output stream:  58
[Thread 0x7ff59af080 (LWP 2900) exited]
[Thread 0x7ff636f080 (LWP 2899) exited]
[Thread 0x7ff7ff5ca0 (LWP 2894) exited]
[Thread 0x7ff5139080 (LWP 2901) exited]
[New process 2894]
[Inferior 1 (process 2894) exited with code 01]
(gdb)
escuta commented 1 year ago

The above was with the ssh connection done as: ssh -Y iain@ipaddress I use -Y because -X causes constant crashes. I logged in again with: "ssh -X iain@ipaddress" and this was the result:

[iain@botanica ~]$ gdb --args ~/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host probe ~/.vst3/IEM/BinauralDecoder.vst3
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host...
(gdb) run
Starting program: /home/iain/.local/share/SuperCollider/Extensions/VSTPlugin/plugins/host probe /home/iain/.vst3/IEM/BinauralDecoder.vst3

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org 
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
probing /home/iain/.vst3/IEM/BinauralDecoder.vst3 -1
[New Thread 0x7ff636f080 (LWP 2924)]
Xlib:  extension "MIT-SHM" missing on display "localhost:11.0".
[New Thread 0x7ff5949080 (LWP 2926)]
[New Thread 0x7ff5139080 (LWP 2925)]
created VST3 component
created VST3 controller
connected component and controller
Vst::kParamValuesChanged
didn't synchronize state
num programs: 1
program change: 4294967295
bypass: 1652125811
process context requirements:
kNeedSystemTime
kNeedContinousTimeSamples
kNeedProjectTimeMusic
kNeedBarPositionMusic
kNeedCycleMusic
kNeedSamplesToNextClock
kNeedTempo
kNeedTimeSignature
kNeedChord
kNeedFrameRate
kNeedTransportState
destroyed VST3 controller
[Thread 0x7ff5949080 (LWP 2926) exited]
destroyed VST3 component
probe succeeded
[Thread 0x7ff5139080 (LWP 2925) exited]
[Thread 0x7ff7ff5ca0 (LWP 2921) exited]
[Thread 0x7ff636f080 (LWP 2924) exited]
[New process 2921]
[Inferior 1 (process 2921) exited normally]
(gdb)
Spacechild1 commented 1 year ago

Ok, so this seems to be an X11 problem. The second version (with ssh -X) actually looks ok!

I don't know what's going on with that X_ShmDetach request, but if you google a bit, you can find similar issues...

One workaround you could try: run the initial VSTPlugin.search with ssh -X, so that the probing process succeeds, and then continue with ssh -Y. Would be interesting to know if the plugin also crashes when it actually runs on the Server.

Spacechild1 commented 1 year ago

Alternatively, you may try to disable the MIT-SHM X11 extension. Ask google for instructions :-) I have no experience with this.

escuta commented 1 year ago

Great, thanks again for your help! I'll be able to get back to this again tomorrow. I'll let you know how I get on

escuta commented 1 year ago

All working! Thanks a lot for your help! My problem with "ssh -X" only occurs with emacs (which I like to use with SuperCollider) but using scide there are no such crashes, thus far. I'm going to look into this on the Arch forums. I don't know if you've ever tried the Mosca supercollider quark (for authoring of ambisonics/vbap with headtracking and listener location data factored), but I've included a demo using the BinauralDecoder.vst3 in the latest master branch. To find it, run help on the Mosca class, click the "Guide to Mosca" link near the top of the page and scroll down to "Using IEM ambisonic decoders". All the best!

Spacechild1 commented 1 year ago

Yeah! Just had a quick look at Mosca. Great work!