Skip to content

Commit

Permalink
bazelisk-env: override ld harder
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Sep 15, 2024
1 parent b272fc0 commit 63562b1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pkgs/bazelisk-env/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ buildFHSUserEnv {
binutils-unwrapped.out # provides ld
# we don't want to _also_ rebuilt binutils-unwrapped so we just drop in an ld wrapper
# (this is way simpler than messing with wrapping gcc)
(hiPrio (writeShellScriptBin "ld" ''
set -euo pipefail
(hiPrio (symlinkJoin {
name = "ld-override";

# NOTE: building pure 32bit is broken (would need to use expand-params-response and check for 32bit flag).
# but i don't think we need it.
flags=("-dynamic-linker=/lib64/ld-linux-x86-64.so.2")
paths = map (suffix: writeShellScriptBin "ld${suffix}" ''
set -euo pipefail
${binutils-unwrapped}/bin/ld "''${flags[@]}" "$@" "''${flags[@]}"
''))
# NOTE: building pure 32bit is broken (would need to use expand-params-response and check for 32bit flag).
# but i don't think we need it.
flags=("-dynamic-linker=/lib64/ld-linux-x86-64.so.2")
${binutils-unwrapped}/bin/ld${suffix} "''${flags[@]}" "$@" "''${flags[@]}"
'') [ "" ".gold" ".bfd" ".so" ];
}))

pkg-config
python3
Expand Down Expand Up @@ -99,6 +103,7 @@ buildFHSUserEnv {
profile = ''
export BAZELISK_ENV=1
export CC=$(which gcc)
export LD=$(which ld)
CMD=bazelisk
Expand Down

0 comments on commit 63562b1

Please sign in to comment.