surge: fix build with glibc 2.41

The generated ScalablePiggy.S has no .note.GNU-stack section, so the
linker marks the LV2/VST3 plugin .so as requiring an executable stack.
Since glibc 2.41, dlopen() refuses to load such objects, which breaks
the post-build LV2 step that dlopen()s the freshly built plugin to
generate its .ttl manifest:

    OSError: .../Surge.lv2/Surge.so: cannot enable executable stack as
    shared object requires: Invalid argument

Force a non-executable stack at link time with -z noexecstack.

Fixes #533882
This commit is contained in:
Bart Brouns
2026-06-21 15:29:54 +02:00
parent 25785b85d4
commit 49c3b62b24
+8
View File
@@ -73,6 +73,14 @@ stdenv.mkDerivation (finalAttrs: {
# Fix build with gcc 15
env.NIX_CFLAGS_COMPILE = "-Wno-deprecated";
# The generated ScalablePiggy.S has no .note.GNU-stack section, so the linker
# marks the LV2/VST3 plugin .so as requiring an executable stack. Since glibc
# 2.41 dlopen() refuses to load such objects ("cannot enable executable stack
# as shared object requires"). This breaks the post-build step that dlopens
# the freshly built LV2 plugin to generate its .ttl manifest. Force a
# non-executable stack at link time.
env.NIX_LDFLAGS = "-z noexecstack";
postPatch = ''
substituteInPlace src/common/SurgeStorage.cpp \
--replace "/usr/share/Surge" "$out/share/surge"