Skip to content

Commit

Permalink
Add patch to remove .cargo/config.toml to fix aarch64 nix builds
Browse files Browse the repository at this point in the history
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
NixOS/nixpkgs#209697
  • Loading branch information
HanStolpo committed Sep 24, 2024
1 parent e7547b5 commit b74ddea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions nix/patches/remove-cargo-config-toml.patch
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit b74ddea

Please sign in to comment.