Skip to content

Commit 4bde5a3

Browse files
author
Jonathan Ringer
authored
libredirect: fix build for aarch64-darwin (PR #156460)
1 parent fde0b2e commit 4bde5a3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pkgs/build-support/libredirect/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ else stdenv.mkDerivation rec {
4444
-isystem ${llvmPackages_13.clang.libc}/include \
4545
-isystem ${llvmPackages_13.libclang.lib}/lib/clang/*/include \
4646
-L${llvmPackages_13.clang.libc}/lib \
47-
-Wl,-install_name,$out/lib/$libName \
47+
-Wl,-install_name,$libName \
4848
-Wall -std=c99 -O3 -fPIC libredirect.c \
4949
-ldl -shared -o "$libName"
5050
'' else if stdenv.isDarwin then ''
@@ -73,6 +73,12 @@ else stdenv.mkDerivation rec {
7373
7474
install -vD "$libName" "$out/lib/$libName"
7575
76+
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
77+
# dylib will be rejected unless dylib rpath gets explictly set
78+
install_name_tool \
79+
-change $libName $out/lib/$libName \
80+
$out/lib/$libName
81+
'' + ''
7682
# Provide a setup hook that injects our library into every process.
7783
mkdir -p "$hook/nix-support"
7884
cat <<SETUP_HOOK > "$hook/nix-support/setup-hook"

0 commit comments

Comments
 (0)