Skip to content

Commit

Permalink
rustfmt-nightly: add -headerpad_max_install_names x64 darwin
Browse files Browse the repository at this point in the history
fix failing install_name_tool not having enough space to write the path
into the binary

> error: install_name_tool: changing install names or rpaths can't be redone for: /nix/store/.../git-rustfmt (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
  • Loading branch information
paparodeo committed Dec 30, 2024
1 parent 0835650 commit 2546152
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkgs/development/compilers/rust/rustfmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ rustPlatform.buildRustPackage rec {
install_name_tool -add_rpath "${rustc.unwrapped}/lib" "$out/bin/git-rustfmt"
'';

env = lib.optionalAttrs (asNightly && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) {
# give install_name_tool enough space so preFixup doesn't fail
NIX_LDFLAGS = "-headerpad_max_install_names";
};

# As of 1.0.0 and rustc 1.30 rustfmt requires a nightly compiler
RUSTC_BOOTSTRAP = 1;

Expand Down

0 comments on commit 2546152

Please sign in to comment.