From 5bdfec15edd71ba837cf1fa0b0abe86d3b7b415b Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Sat, 19 Sep 2026 22:19:53 -0700 Subject: [PATCH] minimal-bootstrap: don't keep build compiler by unnecessary RPATH for static-only case --- .../linux/minimal-bootstrap/gcc/wrappercxx.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrappercxx.sh b/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrappercxx.sh index 9007d4aa1604..43a1d6ab3574 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrappercxx.sh +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrappercxx.sh @@ -36,6 +36,12 @@ for param in "$@"; do prev="$param" done +# Don't keep build compiler by unnecessary RPATH for static-only case. +libstdcxxRpath="" +if [ -e @libstdcxx@/libstdc++.so ]; then + libstdcxxRpath="-Wl,-rpath,@libstdcxx@" +fi + # Order of -B is very particular. musl detection in gnulib requires that # libc/.. comes before libgcc, otherwise libc is assumed to be glibc. # Also, libstdcxxinc uses #include_next directives that depend on @@ -43,7 +49,8 @@ done exec -a "@origname@" @gcc@ -Wl,-dynamic-linker=@dynlinker@ \ @extraflags@ \ $extraRpath \ - -Wl,-rpath,@libc@,-rpath,@libstdcxx@ \ + -Wl,-rpath,@libc@ \ + $libstdcxxRpath \ -I @libstdcxxarchinc@ \ -I @libstdcxxinc@ \ -B@libc@/.. \