surge-synthesizer / surge

Synthesizer plug-in (previously released as Vember Audio Surge)
https://surge-synthesizer.github.io/
GNU General Public License v3.0
3.09k stars 395 forks source link

Add support for 32 bit raspberry PI (was: build failure on 32 bit) #6481

Open rossec opened 2 years ago

rossec commented 2 years ago

uname -a output: Linux raspberrypi 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l GNU/Linux

Error:

Scanning dependencies of target surge-common [ 62%] Building CXX object src/common/CMakeFiles/surge-common.dir/dsp/Effect.cpp.o In file included from /home/jake/surge/src/common/dsp/effects/chowdsp/SpringReverbEffect.h:22, from /home/jake/surge/src/common/dsp/Effect.cpp:26: /home/jake/surge/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.h:55:32: error: ‘SIMDRegister’ in namespace ‘juce::dsp’ does not name a template type 55 | using VecType = juce::dsp::SIMDRegister; | ^~~~ /home/jake/surge/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.h:56:52: error: ‘VecType’ was not declared in this scope 56 | using APFCascade = std::array<SchroederAllpass<VecType, 2>, allpassStages>; | ^~~ /home/jake/surge/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.h:56:62: error: template argument 1 is invalid 56 | using APFCascade = std::array<SchroederAllpass<VecType, 2>, allpassStages>; | ^

/home/jake/surge/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.h:56:78: error: template argument 1 is invalid 56 | g APFCascade = std::array<SchroederAllpass<VecType, 2>, allpassStages>; | ^

/home/jake/surge/src/common/dsp/effects/chowdsp/spring_reverb/SpringReverbProc.h:57:5: error: ‘APFCascade’ does not name a type 57 | APFCascade vecAPFs; | ^~~~~~ gmake[3]: [src/common/CMakeFiles/surge-common.dir/build.make:303: src/common/CMakeFiles/surge-common.dir/dsp/Effect.cpp.o] Error 1 gmake[2]: [CMakeFiles/Makefile2:1057: src/common/CMakeFiles/surge-common.dir/all] Error 2 gmake[1]: [CMakeFiles/Makefile2:886: src/CMakeFiles/surge-staged-assets.dir/rule] Error 2 gmake: [Makefile:284: surge-staged-assets] Error 2

mkruselj commented 2 years ago

@baconpaul Does this require a CMake switch or something?

baconpaul commented 2 years ago

No. It is a result of a convo we had on discord so I can remember it.

I think thst use of simd register in spring is something we should just engineer out. It also causes the avx problem.

alcomposer commented 1 year ago

I don't know if it's related, but I'm trying to build latest main on Rpi. Getting this error:

uname -a output: Linux raspberrypi 5.15.56-v7l+ #1575 SMP Fri Jul 22 20:29:46 BST 2022 armv7l GNU/Linux

Followed instructions here: https://github.com/surge-synthesizer/surge/blob/main/README.md

cmake -Bbuild -DLINUX_ON_ARM=True
cmake --build build --config Release --target surge-staged-assets
In file included from /home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters.h:26,
                 from /home/pi/Documents/github/surge/src/common/FilterConfiguration.h:19,
                 from /home/pi/Documents/github/surge/src/common/SurgeStorage.h:474,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.h:19,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.cpp:16:
/home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters/OBXDFilter.h: In function ‘__m128 sst::filters::OBXDFilter::process_4_pole(sst::filters::QuadFilterUnitState*, __m128)’:
/home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters/OBXDFilter.h:270:41: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     float s1_rcor24_arr alignas(16)[ssew];
                                         ^
In file included from /home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters.h:33,
                 from /home/pi/Documents/github/surge/src/common/FilterConfiguration.h:19,
                 from /home/pi/Documents/github/surge/src/common/SurgeStorage.h:474,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.h:19,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.cpp:16:
/home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters/QuadFilterUnit_Impl.h: In function ‘__m128 sst::filters::COMBquad_SSE2(sst::filters::QuadFilterUnitState*, __m128)’:
/home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters/QuadFilterUnit_Impl.h:539:26: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     int DTi alignas(16)[4], SEi alignas(16)[4];
                          ^
/home/pi/Documents/github/surge/libs/sst/sst-filters/include/sst/filters/QuadFilterUnit_Impl.h:539:46: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     int DTi alignas(16)[4], SEi alignas(16)[4];
                                              ^
In file included from /home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/Saturators.h:6,
                 from /home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/QuadWaveshaper_Impl.h:7,
                 from /home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers.h:26,
                 from /home/pi/Documents/github/surge/src/common/FilterConfiguration.h:20,
                 from /home/pi/Documents/github/surge/src/common/SurgeStorage.h:474,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.h:19,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.cpp:16:
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/WaveshaperLUT.h: In function ‘__m128 sst::waveshapers::WS_LUT(sst::waveshapers::QuadWaveshaperState*, const float*, __m128, __m128)’:
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/WaveshaperLUT.h:36:27: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     short e4 alignas(16)[8];
                           ^
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/WaveshaperLUT.h: In function ‘__m128 sst::waveshapers::WS_PM1_LUT(const float*, __m128)’:
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/WaveshaperLUT.h:73:27: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     short e4 alignas(16)[8];
                           ^
In file included from /home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/QuadWaveshaper_Impl.h:8,
                 from /home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers.h:26,
                 from /home/pi/Documents/github/surge/src/common/FilterConfiguration.h:20,
                 from /home/pi/Documents/github/surge/src/common/SurgeStorage.h:474,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.h:19,
                 from /home/pi/Documents/github/surge/src/common/FxPresetAndClipboardManager.cpp:16:
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/Effects.h: In function ‘__m128 sst::waveshapers::SINUS_SSE2(sst::waveshapers::QuadWaveshaperState*, __m128, __m128)’:
/home/pi/Documents/github/surge/libs/sst/sst-waveshapers/include/sst/waveshapers/Effects.h:47:27: error: requested alignment 16 is larger than 8 [-Werror=attributes]
     short e4 alignas(16)[8];
                           ^
cc1plus: all warnings being treated as errors
make[3]: *** [src/common/CMakeFiles/surge-common.dir/build.make:76: src/common/CMakeFiles/surge-common.dir/FxPresetAndClipboardManager.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1030: src/common/CMakeFiles/surge-common.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:886: src/CMakeFiles/surge-staged-assets.dir/rule] Error 2
make: *** [Makefile:265: surge-staged-assets] Error 2
baconpaul commented 1 year ago

Are you on 64 bit os or 32? Also what’s your compiler toolchain

tbis looks to me like the warning promotion is tripping you up and I wonder if that warning is new with a compiler version. We may just need to add a Wno-attributes flag on pi

alcomposer commented 1 year ago

Thanks @baconpaul! It was an old RPi install (fully updated). Will reflash with 64 asap!

baconpaul commented 1 year ago

Yeah it might work 32 but I bet we need to tweak compiler flsgs. If you get that working happy to review and merge

I haven’t built 64 lately but I build before every release to test so 112 did build iirc

marvellousmess commented 1 year ago

@baconpaul @rossec I'm having the same error when compiling, it quits at the spring reverb. Running 64bit Raspberry Pi OS. Can either of you suggest what to do?

baconpaul commented 1 year ago

I am traveling and don't have my Pi easily available but i'll add to my list to look.

Can you share your compiler version and os version? A quick google shows that exact alignment error is a gcc bug in some gcc versions perhaps, and occurs in raspbian.

marvellousmess commented 1 year ago

It is Raspbian Bullseye 11.7, GCC says: gcc version 10.2.1 20210110 (Raspbian 10.2.1-6+rpi1). uname -a output: Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux So it means it needs a different compiler version? Not very familiar with this stuff tbh.

baconpaul commented 1 year ago

I’m not sure - I need to boot my pi after the weekend. But if you are seeing the same alignment warning it is indeed a mistake in the toolchain. I may be able to ignore the error in gcc thoigh

baconpaul commented 1 year ago

Doing a compile with

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux
pi@raspberrypi:~ $ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

at head did

cmake -Bignore/s13 -DCMAKE_BUILD_TYPE=DEBUG
cmake --build ignore/s13 --parallel 3

and while it wasn't fast, everything built.

I really think this alignment error is a gcc bug with your gcc version. I'm hesitant to do a -Wno-attributes or what not across the entire source but if you can figure out a way to detect that it is a native ARM build and add the appropriate flag to work around this, I'd be happy to merge it.

baconpaul commented 1 year ago

OK I'm going to push a change this morning that makes the build on 32 bit pi fail in 2 seconds rather than 40 minutes and includes a comment on what a person would do to fix it; it will also updated the README with comments on what versions work and how to build natively. I'm moving this issue to "currently unscheduled" and changing the title to "add support for 32 bit raspberry pi builds"