AuburnSounds / Dplug

Audio plugin framework. VST2/VST3/AU/AAX/LV2 for Linux/macOS/Windows.
https://dplug.org/
Other
486 stars 32 forks source link

LV2 build may fail on certain circumstances #450

Closed m3m0ry closed 4 years ago

m3m0ry commented 4 years ago

I am trying to build the examples. I am using the dplug-build. There seems to be two different issues.

  1. VST3 This does not build at all. Since it is in the dependencies, the build process tries to build dplug:vst3, no matter what the -c argument is. I am getting the following output:
    
    info: Missing "licensePath" in plugin.json (eg: "license.txt")
    info: Missing "iconPath-windows" in plugin.json (eg: "gfx/myIcon.ico")
    info: Missing "iconPath-osx" in plugin.json (eg: "gfx/myIcon.png")

=> Bundling plug-in CLIP It from Witty Audio, archs 64-bit configurations: ["LV2"], build type debug, compiler ldc2

** Building configuration LV2 with ldc2, 64-bit arch... $ dub build --build=debug --arch=x86_64 --compiler=ldc2 --config=LV2 Performing "debug" build using ldc2 for x86_64. dplug:core 9.1.10: building configuration "library"... dplug:carbon 9.1.10: building configuration "library"... dplug:client 9.1.10: building configuration "library"... dplug:cocoa 9.1.10: building configuration "library"... dplug:au 9.1.10: building configuration "library"... intel-intrinsics 1.2.2: building configuration "library"... pfft 1.0.6: building configuration "library"... dplug:dsp 9.1.10: building configuration "library"... gfm:math 8.0.3: building configuration "library"... dplug:graphics 9.1.10: building configuration "library"... dplug:x11 9.1.10: building configuration "library"... dplug:window 9.1.10: building configuration "library"... dplug:gui 9.1.10: building configuration "library"... dplug:flat-widgets 9.1.10: building configuration "library"... dplug:lv2 9.1.10: building configuration "library"... dplug:vst 9.1.10: building configuration "library"... dplug:vst3 9.1.10: building configuration "library"... ldc2: /build/ldc-jszirN/ldc-1.20.0/gen/classes.cpp:430: llvm::Value DtoVirtualFunctionPointer(DValue, FuncDeclaration, const char*): Assertion `fdecl->vtblIndex > 0 || (fdecl->vtblIndex == 0 && fdecl->linkage == LINKcpp)' failed. /usr/lib/x86_64-linux-gnu/libLLVM-9.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f2fe2d54bdf] /usr/lib/x86_64-linux-gnu/libLLVM-9.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x22)[0x7f2fe2d52fc2] /usr/lib/x86_64-linux-gnu/libLLVM-9.so.1(+0xb7dfe1)[0x7f2fe2d54fe1] /lib/x86_64-linux-gnu/libpthread.so.0(+0x13520)[0x7f2fe219c520] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141)[0x7f2fe1cd5f61] /lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f2fe1cc1535] /lib/x86_64-linux-gnu/libc.so.6(+0x2540f)[0x7f2fe1cc140f] /lib/x86_64-linux-gnu/libc.so.6(+0x32b92)[0x7f2fe1cceb92] ldc2(_Z25DtoVirtualFunctionPointerP6DValueP15FuncDeclarationPKc+0x256)[0x564b451c1cd6] ldc2(+0x6ff93a)[0x564b4516893a] ldc2(_Z6toElemP10Expression+0x7a)[0x564b4516019a] ldc2(+0x700d25)[0x564b45169d25] ldc2(+0x700f6f)[0x564b45169f6f] ldc2(_Z6toElemP10Expression+0x7a)[0x564b4516019a] ldc2(+0x701b3e)[0x564b4516ab3e] ldc2(_Z10toElemDtorP10Expression+0x7a)[0x564b4516044a] ldc2(+0x6eb436)[0x564b45154436] ldc2(+0x6e3091)[0x564b4514c091] ldc2(+0x6e2f4a)[0x564b4514bf4a] ldc2(+0x6eb683)[0x564b45154683] ldc2(+0x6e3091)[0x564b4514c091] ldc2(+0x6e2f4a)[0x564b4514bf4a] ldc2(+0x6eb683)[0x564b45154683] ldc2(+0x6e2f4a)[0x564b4514bf4a] ldc2(+0x6e4693)[0x564b4514d693] ldc2(+0x6e3091)[0x564b4514c091] ldc2(+0x6e2f4a)[0x564b4514bf4a] ldc2(+0x6e3091)[0x564b4514c091] ldc2(+0x6e3091)[0x564b4514c091] ldc2(_Z14Statement_toIRP9StatementP7IRState+0x2d)[0x564b4514b8fd] ldc2(_Z17DtoDefineFunctionP15FuncDeclarationb+0xc35)[0x564b4510bb55] ldc2(+0x694890)[0x564b450fd890] ldc2(+0x694890)[0x564b450fd890] ldc2(+0x694890)[0x564b450fd890] ldc2(+0x694890)[0x564b450fd890] ldc2(+0x696350)[0x564b450ff350] ldc2(_Z19Declaration_codegenP7Dsymbol+0x34)[0x564b450fd174] ldc2(_Z13codegenModuleP7IRStateP6Module+0x11e)[0x564b4511ffde] ldc2(_ZN3ldc13CodeGenerator4emitEP6Module+0x95)[0x564b451dfc75] ldc2(_Z14codegenModulesR5ArrayIP6ModuleE+0x17f)[0x564b451af89f] ldc2(_Z13marsmainBodyR5ParamR5ArrayIPKcES5+0x18db)[0x564b44f86c0b] ldc2(_Z7cppmainv+0x1692)[0x564b451b1d12] ldc2(_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv+0x50)[0x564b45312b90] ldc2(_d_run_main2+0x18f)[0x564b4531299f] ldc2(_d_run_main+0x8e)[0x564b453127fe] ldc2(main+0x24e)[0x564b44e9261e] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f2fe1cc2bbb] ldc2(_start+0x2a)[0x564b44e9490a] Aborted ldc2 failed with exit code 134. error: Command 'dub build --build=debug --arch=x86_64 --compiler=ldc2 --config=LV2' returned 2


2. LV2
Since VST3 was not working, i tried LV2, since it is supposed to be the most "open source" option.
I remove VST3 from the dependencies.
It does build, however during `Extract manifest` it can't open some file.
This confuses me. I have check. The file is there. It is a freshly cloned repository (master branch)
I have the following output:

info: Missing "licensePath" in plugin.json (eg: "license.txt") info: Missing "iconPath-windows" in plugin.json (eg: "gfx/myIcon.ico") info: Missing "iconPath-osx" in plugin.json (eg: "gfx/myIcon.png")

=> Bundling plug-in CLIP It from Witty Audio, archs 64-bit configurations: ["LV2"], build type debug, compiler ldc2

*** Building configuration LV2 with ldc2, 64-bit arch... $ dub build --build=debug --arch=x86_64 --compiler=ldc2 --config=LV2 Performing "debug" build using ldc2 for x86_64. dplug:core 9.1.10: target for configuration "library" is up to date. dplug:carbon 9.1.10: target for configuration "library" is up to date. dplug:client 9.1.10: target for configuration "library" is up to date. dplug:cocoa 9.1.10: target for configuration "library" is up to date. dplug:au 9.1.10: target for configuration "library" is up to date. intel-intrinsics 1.2.2: target for configuration "library" is up to date. pfft 1.0.6: target for configuration "library" is up to date. dplug:dsp 9.1.10: target for configuration "library" is up to date. gfm:math 8.0.3: target for configuration "library" is up to date. dplug:graphics 9.1.10: target for configuration "library" is up to date. dplug:x11 9.1.10: target for configuration "library" is up to date. dplug:window 9.1.10: target for configuration "library" is up to date. dplug:gui 9.1.10: target for configuration "library" is up to date. dplug:flat-widgets 9.1.10: target for configuration "library" is up to date. dplug:lv2 9.1.10: target for configuration "library" is up to date. dplug:vst 9.1.10: target for configuration "library" is up to date. clipit ~master: building configuration "LV2"... Linking... To force a rebuild of up-to-date targets, run again with --force. => Build OK, binary size = 11.2 mb, available in ./builds/Linux-64b-LV2

*** Extract LV2 manifest from binary... core.exception.AssertError@../../core/dplug/core/sharedlib.d(39): Couldn't open the shared library.

??:? _d_assert_msg [0x5590b9543aee] ../../core/dplug/core/sharedlib.d:39 nothrow @nogc void dplug.core.sharedlib.SharedLib.load(immutable(char)[]) [0x5590b95385b2] source/main.d:541 void main.main(immutable(char)[][]).buildAndPackage(immutable(char)[], plugin.Arch[], immutable(char)[]).extractLV2ManifestFromBinary(immutable(char)[], immutable(char)[], bool, immutable(char)[]) [0x5590b94810cf] source/main.d:687 void main.main(immutable(char)[][]).buildAndPackage(immutable(char)[], plugin.Arch[], immutable(char)[]) [0x5590b94808b8] source/main.d:945 _Dmain [0x5590b947fecc]


I am on Linux. Debian testing. I installed ldc2 from the distribution package manager.

ldc2 --version LDC - the LLVM D compiler (1.20.0): based on DMD v2.090.1 and LLVM 9.0.1 built with LDC - the LLVM D compiler (1.20.0) Default target: x86_64-pc-linux-gnu Host CPU: haswell http://dlang.org - http://wiki.dlang.org/LDC

Registered Targets: aarch64 - AArch64 (little endian) aarch64_32 - AArch64 (little endian ILP32) aarch64_be - AArch64 (big endian) amdgcn - AMD GCN GPUs arm - ARM arm64 - ARM64 (little endian) arm64_32 - ARM64 (little endian ILP32) armeb - ARM (big endian) avr - Atmel AVR Microcontroller bpf - BPF (host endian) bpfeb - BPF (big endian) bpfel - BPF (little endian) hexagon - Hexagon lanai - Lanai mips - MIPS (32-bit big endian) mips64 - MIPS (64-bit big endian) mips64el - MIPS (64-bit little endian) mipsel - MIPS (32-bit little endian) msp430 - MSP430 [experimental] nvptx - NVIDIA PTX 32-bit nvptx64 - NVIDIA PTX 64-bit ppc32 - PowerPC 32 ppc64 - PowerPC 64 ppc64le - PowerPC 64 LE r600 - AMD GPUs HD2XXX-HD6XXX riscv32 - 32-bit RISC-V riscv64 - 64-bit RISC-V sparc - Sparc sparcel - Sparc LE sparcv9 - Sparc V9 systemz - SystemZ thumb - Thumb thumbeb - Thumb (big endian) wasm32 - WebAssembly 32-bit wasm64 - WebAssembly 64-bit x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 xcore - XCore



It is also the first time, that i am using `ldc` at all. So maybe the problem is somewhere at my side.

Does someone has any idea what am i doing wrong?
abaga129 commented 4 years ago

I'm not very sure about the VST3 issue, but my hunch about the LV2 issue you are having is that it is a mismatch between the architecture of your dplug-build and the plugin you are trying to build. It's possible that by default your dplug-build got built as x86. I would try rebuilding it with dub -a x86_64 -b debug --compiler ldc2.

m3m0ry commented 4 years ago

I have no idea what the dplug-build actually does. I am completely new to dplug. LV2 issue was, that i used dmd and not ldc2. Just the flag --compiler ldc2 solves the issue. I don't understand why though. VST3 issue is unchanged.

abaga129 commented 4 years ago

Well I'm glad to hear that it fixed atleast part of your problem! @p0nce will likely know more about what the issue your having with VST3 is.

dplug-build is necessary for basically every format except VST. In a nutshell, it wraps dub to build your plugin and generates other needed files depending on the format and operating system.

In the case of LV2 it creates the .lv2 folder to put your binary in and then loads the binary to generate the manifest file for it. It also has flags to automatically create installers on Windows and MacOS. I'm not sure what it does differently for VST3 format since I havent worked on that format at all.

To test if your VST3 issue is dplug-build specific or if it is a compiler issue, you can build just the binary using dub -a x86_64 -b debug -c VST3 --compiler ldc2. To use the plugin in Reaper on linux then you just need to rename the binary to have a .vst3 file extension.

m3m0ry commented 4 years ago

It seems to be a compiler (or any other issue then dplub-build). The command dub -a x86_64 -b debug -c VST3 --compiler ldc2 reproduces my error above. And if enabeling VST2 in the dub.json i get:

Invalid source/import path: /home/hrom/git/d/Dplug/$VST2_SDK/pluginterfaces/vst2.x
Invalid variable: VST2_SDK

However i am happy to have LV2. Since i am completely new, do you have any tips for me? What software on Linux uses LV2? I am looking towards Qtractor or Ardour.

p0nce commented 4 years ago

Hello @m3m0ry,

p0nce commented 4 years ago

LV2 issue was, that i used dmd and not ldc2.

Mmmm, this shouldn't crash like this anyway. This is a Dplug bug.

m3m0ry commented 4 years ago

Mmmm, this shouldn't crash like this anyway. This is a Dplug bug.

Seems like a problem in sharedlib.d, i guess line 166. I have run it with debugSharedLibs and it tries to load: loading dynlib 'builds/Linux-64b-LV2/WittyAudioCLIPIt.so' This library is present. I don't really understand, why loading is different under dmd and ldc.

p0nce commented 4 years ago

Perhaps there is a hidden requirement that dplug-build should be built with the same compiler that the compiler used to build the plug-in? It would be interesting to test DMD + DMD / DMD + LDC / LDC + DMD and LDC + LDC to see the combinations that work in LV2.

p0nce commented 4 years ago

@m3m0ry I don't manage to reproduce your dplug:vst3 problem (see #451 ) Please install LDC using https://github.com/ldc-developers/ldc/releases have you used another method?

For the dplug-build LV2 problem, here are the steps to reproduce the crash:

p0nce commented 4 years ago

Stack trace is showing:

(lldb) bt
* thread #1, name = 'dplug-build', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x0000555555777703 dplug-build`_D2rt8monitor_13ensureMonitorFNbC6ObjectZPOSQBqQBq7Monitor + 159
    frame #1: 0x0000555555777601 dplug-build`_d_monitorenter + 25
    frame #2: 0x00007ffff67f2266 WittyAudioCLIPIt.so`_D4core6thread6Thread__T10getAllImplS_DQBlQBjQBf7opApplyFMDFKCQCiQCgQCcZiZ6resizeFNbNiKAQBbmZvZQCtFNiZQp + 54
    frame #3: 0x00007ffff67f2186 WittyAudioCLIPIt.so`_D4core6thread6Thread7opApplyFMDFKCQBhQBfQBbZiZi + 22
    frame #4: 0x000055555579fc7f dplug-build`_D2rt5minfo__T17runModuleFuncsRevSQBgQBg11ModuleGroup8runDtorsMFZ9__lambda1ZQCkMFAxPyS6object10ModuleInfoZv + 87
    frame #5: 0x000055555579f799 dplug-build`_D2rt5minfo11ModuleGroup8runDtorsMFZv + 33
    frame #6: 0x000055555579fa31 dplug-build`_D2rt5minfo13rt_moduleDtorUZ14__foreachbody1MFKSQBu19sections_elf_shared3DSOZi + 29
    frame #7: 0x0000555555777c06 dplug-build`_D2rt19sections_elf_shared3DSO14opApplyReverseFMDFKSQByQByQBgZiZi + 74
    frame #8: 0x000055555579fa11 dplug-build`rt_moduleDtor + 21
    frame #9: 0x000055555579cd62 dplug-build`rt_term + 70
    frame #10: 0x0000555555771e86 dplug-build`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 202
    frame #11: 0x0000555555771d6d dplug-build`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv + 33
    frame #12: 0x0000555555771cd6 dplug-build`_d_run_main2 + 558
    frame #13: 0x0000555555771a92 dplug-build`_d_run_main + 190
    frame #14: 0x00005555556b4c72 dplug-build`main(argc=5, argv=0x00007fffffffdee8) at entrypoint.d:34
    frame #15: 0x00007ffff6e24b97 libc.so.6`__libc_start_main(main=(dplug-build`main at entrypoint.d:32), argc=5, argv=0x00007fffffffdee8, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffded8) at libc-start.c:310
    frame #16: 0x00005555556ac1ca dplug-build`_start + 42
(lldb) 
p0nce commented 4 years ago

dplug-build tries to run the module destructors of the plug-in, which doesn't work because the runtime isn't enabled... I don't really get what happens there.

p0nce commented 4 years ago

A working work-around is to always build dplug-build with LDC (and not DMD) on Windows.

p0nce commented 4 years ago

It's complicated...

p0nce commented 4 years ago