Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Use correct dynamic linker/loader on musl-based systems (Alpine).


---
Verified on Alpine Linux 3.12. See https://builds.sr.ht/~fsx/job/305669

 configure | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index b895748e..08c7b7fb 100755
--- a/configure
+++ b/configure
@@ -45,12 +45,19 @@ sysinit=''
 env='[][:]'
 case $OS in
     *Linux*)
+        ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
+        if [ x"${ldd_version}" = x"musl" ]; then
+            dyn_loader='/lib/ld-musl-x86_64.so.1'
+        else
+            dyn_loader='/lib64/ld-linux-x86-64.so.2'
+        fi
+
         echo 'export SYS=linux' >> config.mk
         echo export INST_MAN=$prefix/share/man/man >> config.mk
         echo 'const Sys = "Linux"' >> mbld/config.myr
         echo 'const Linkcmd = ["ld", "--gc-sections"]' >> mbld/config.myr
         echo 'const Dlflags = ["-dynamic-linker",' \
-            '"/lib64/ld-linux-x86-64.so.2"]' >> mbld/config.myr
+            "\"$dyn_loader\"]" >> mbld/config.myr
         echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
         ;;
     *Darwin*)
-- 
2.28.0