From b74ddea62b794429d6c78981b7008f010af39732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Handr=C3=A9=20Stolp?= Date: Tue, 24 Sep 2024 16:33:07 +0200 Subject: [PATCH] Add patch to remove `.cargo/config.toml` to fix aarch64 nix builds Using the flake on aarch4-linux in nix leads to an error `error: linker 'aarch64-linux-gnu-gcc' not found` which is apparently fixed by deleting the `.cargo/config.toml` according to this nixos issue / PR https://github.com/NixOS/nixpkgs/pull/209697 --- flake.nix | 6 +++++ nix/patches/remove-cargo-config-toml.patch | 30 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 nix/patches/remove-cargo-config-toml.patch diff --git a/flake.nix b/flake.nix index afc229c..357c1f5 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,12 @@ # Common arguments can be set here to avoid repeating them later commonArgs = { inherit src; + + patches = [ + # the presence of .cargo/config.toml apparently + # breaks nix builds on aarch64-linux + ./nix/patches/remove-cargo-config-toml.patch + ]; strictDeps = true; nativeBuildInputs = [ pkgs.protobuf diff --git a/nix/patches/remove-cargo-config-toml.patch b/nix/patches/remove-cargo-config-toml.patch new file mode 100644 index 0000000..35d4b2c --- /dev/null +++ b/nix/patches/remove-cargo-config-toml.patch @@ -0,0 +1,30 @@ +:100644 000000 a55a502bb 000000000 D .cargo/config.toml + +diff --git a/.cargo/config.toml b/.cargo/config.toml +deleted file mode 100644 +index a55a502bb..000000000 +--- a/.cargo/config.toml ++++ /dev/null +@@ -1,22 +0,0 @@ +-[target.x86_64-unknown-linux-gnu] +-rustflags = ["-C", "target-feature=+sse2,+ssse3,+sse4.1,+sse4.2"] +- +-[target.x86_64-unknown-linux-musl] +-rustflags = ["-C", "target-feature=+sse2,+ssse3,+sse4.1,+sse4.2"] +- +-[target.aarch64-unknown-linux-gnu] +-linker = "aarch64-linux-gnu-gcc" +-rustflags = ["-C", "target-feature=+neon"] +- +-[target.aarch64-unknown-linux-musl] +-linker = "aarch64-linux-gnu-gcc" +-rustflags = ["-C", "target-feature=+neon"] +- +-[target.aarch64-apple-darwin] +-rustflags = ["-C", "target-feature=+neon"] +- +-[target.x86_64-apple-darwin] +-rustflags = ["-C", "target-feature=+sse2,+ssse3,+sse4.1,+sse4.2"] +- +-[target.x86_64-pc-windows-msvc] +-rustflags = ["-C", "target-feature=+sse2,+ssse3,+sse4.1,+sse4.2"]