From e891683f2eac59c6bec93df88e5b82ef3be16394 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 24 Jan 2022 16:54:05 +0800 Subject: [PATCH] flake: hack-link libstdc++ statically on Windows. Closes #175 --- flake.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flake.nix b/flake.nix index 14a17c4d0..23b8de188 100644 --- a/flake.nix +++ b/flake.nix @@ -160,6 +160,14 @@ buildInputs = [ pkgs-mingw.zlib ]; configurePhase = '' + # Link libstdc++ statically. As usual with cargo, this is an adventure. + cp --no-preserve=mode,ownership -R $CARGO_HOME/cargo-vendor-dir/llvm-sys-130.0.1/ llvm-sys-130.0.1 + substituteInPlace llvm-sys-130.0.1/build.rs --replace "cargo:rustc-link-lib=dylib=" "cargo:rustc-link-lib=static=" + substituteInPlace llvm-sys-130.0.1/build.rs --replace "fn main() {" "fn main() { println!(\"cargo:rustc-link-search=native=${pkgs-mingw.stdenv.cc.cc}/x86_64-w64-mingw32/lib\");" + chmod 755 $CARGO_HOME/cargo-vendor-dir + rm $CARGO_HOME/cargo-vendor-dir/llvm-sys-130.0.1 + mv llvm-sys-130.0.1 $CARGO_HOME/cargo-vendor-dir/llvm-sys-130.0.1 + export PYO3_CONFIG_FILE=${pyo3-mingw-config} mkdir llvm-cfg