Bug#1022067: zynaddsubfx: FTBFS on riscv64

Source: zynaddsubfx
Version: 3.0.6-3
Severity: important
Tags: ftbfs patch
Justification: fails to build from source (but built successfully in the past)
User: debian-ri...@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: i...@hack3r.moe, debian-ri...@lists.debian.org

Dear maintainers,

zynaddsubfx failed to build on riscv64 due to gcc missing sub-word atomics:

```
[ 78%] Building CXX object 
src/Plugin/Distortion/CMakeFiles/ZynDistortion_vst.dir/__/__/__/DPF/distrho/DistrhoPluginMain.cpp.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/Plugin/Distortion && /usr/bin/c++ 
-DALSA=1 -DDISTRHO_PLUGIN_TARGET_VST2 -DFLTK_GUI -DHAVE_ASYNC=1 
-DHAVE_CPP_STD_COMPLEX=1 -DHAVE_SCHEDULER=1 -DJACK=1 -DOSS=1 -DUSE_NSM=1 
-DVERSION=\"\" -DZynDistortion_vst_EXPORTS -I/<<PKGBUILDDIR>>/rtosc/include 
-I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src -I/usr/lib/fltk 
-I/<<PKGBUILDDIR>>/src/UI -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/UI 
-I/<<PKGBUILDDIR>>/src 
-I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/Plugin/Distortion 
-I/<<PKGBUILDDIR>>/DPF/distrho -I/<<PKGBUILDDIR>>/src/Plugin/Distortion/. -g 
-O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat 
-Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++11 
-Wno-unused-parameter -O3 -ffast-math -fomit-frame-pointer  -fPIC   -Wall 
-Wextra -fPIC -Wno-parentheses -MD -MT 
src/Plugin/Distortion/CMakeFiles/ZynDistortion_vst.dir/__/__/__/DPF/distrho/DistrhoPluginMain.cpp.o
 -MF 
CMakeFiles/ZynDistortion_vst.dir/__/__/__/DPF/distrho/DistrhoPluginMain.cpp.o.d 
-o 
CMakeFiles/ZynDistortion_vst.dir/__/__/__/DPF/distrho/DistrhoPluginMain.cpp.o 
-c /<<PKGBUILDDIR>>/DPF/distrho/DistrhoPluginMain.cpp
/usr/bin/ld: libzynaddsubfx_core.a(Master.cpp.o): in function `.L0 ':
/usr/include/riscv64-linux-gnu/bits/string_fortified.h:59: undefined reference 
to `__atomic_exchange_1'
collect2: error: ld returned 1 exit status
```

Full buildd log: 
https://buildd.debian.org/status/fetch.php?pkg=zynaddsubfx&arch=riscv64&ver=3.0.6-3&stamp=1665440667&raw=0

Attached is a patch that links libatomic manually on riscv64. If more help is
needed, please let me know.

Cheers,
Eric
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -583,6 +583,10 @@
     ${PTHREAD_LIBRARY}
     rtosc rtosc-cpp)
 
+if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "riscv64")
+    target_link_libraries(zynaddsubfx_core atomic)
+endif()
+
 if(IwyuErr)
     message (STATUS "Include what you use: ${IwyuErr}")
 else()

Read more here: Source link