build: fix C++ dylibs on Musl by working around Nixpkgs brokenness

Change-Id: Iad30ec38eef8205e2d73553caddbbbc96a6a6964
This commit is contained in:
Qyriad
2026-06-22 21:18:56 +02:00
parent 2ea4b5d9e1
commit 63fb295ad8
+11
View File
@@ -571,6 +571,17 @@ stdenv.mkDerivation (finalAttrs: {
}
// lib.optionalAttrs hostPlatform.isStatic {
NIX_CFLAGS_COMPILE = " -static";
}
// lib.optionalAttrs (hostPlatform.isStatic && stdenv.cc.libcxx == null) {
# pkgsStatic.clangStdenv.cc does not have the correct libstdc++.
# It's using pkgsStatic.buildPackages.gcc.cc, whose libstdc++ appears
# to have object files that were compiled with -fno-pic,
# (R_X86_64_32, R_X86_64_32S, and R_X86_64_TPOFF32 relocations).
# pkgsStatic.gcc.cc's libstdc++ has the correct relocations, but idk
# what the correct `wrapCCWith`/`stdenv.cc.override` incantation is.
# But just putting that libstdc++ in `-L` seems to make the driver find
# the right things.
NIX_CFLAGS_LINK = "-L${lib.makeLibraryPath [ pkgsStatic.gcc.cc ]}";
};
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };