bun: fix missing symbol crash on macOS 12

Adds `darwin.ICU` to the library path.

Fixes the following error:

> dyld[69576]: Symbol not found: _ubrk_clone
>   Referenced from: /nix/store/zz94xy01809rlwp70hakg5ws10acma3v-bun-1.1.36/bin/bun
>   Expected in: /usr/lib/libicucore.A.dylib
This commit is contained in:
Sander 2024-11-22 20:17:46 +04:00
parent 07a431c62f
commit 25bd3f0971
No known key found for this signature in database
GPG Key ID: D1A763BC84F34603

View File

@ -4,11 +4,13 @@
, autoPatchelfHook
, unzip
, installShellFiles
, makeWrapper
, openssl
, writeShellScript
, curl
, jq
, common-updater-scripts
, darwin
}:
stdenvNoCC.mkDerivation rec {
@ -18,7 +20,7 @@ stdenvNoCC.mkDerivation rec {
src = passthru.sources.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
strictDeps = true;
nativeBuildInputs = [ unzip installShellFiles ] ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
nativeBuildInputs = [ unzip installShellFiles makeWrapper ] ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = [ openssl ];
dontConfigure = true;
@ -33,14 +35,17 @@ stdenvNoCC.mkDerivation rec {
runHook postInstall
'';
# We currently cannot generate completions for x86_64-darwin because bun requires avx support to run, which is:
# 1. Not currently supported by the version of Rosetta on our aarch64 builders
# 2. Is not correctly detected even on macOS 15+, where it is available through Rosetta
#
# The baseline builds are no longer an option because they too now require avx support.
postInstall =
lib.optionalString
lib.optionalString stdenvNoCC.hostPlatform.isDarwin ''
wrapProgram $out/bin/bun \
--prefix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath [ darwin.ICU ]}
''
# We currently cannot generate completions for x86_64-darwin because bun requires avx support to run, which is:
# 1. Not currently supported by the version of Rosetta on our aarch64 builders
# 2. Is not correctly detected even on macOS 15+, where it is available through Rosetta
#
# The baseline builds are no longer an option because they too now require avx support.
+ lib.optionalString
(
stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform
&& !(stdenvNoCC.hostPlatform.isDarwin && stdenvNoCC.hostPlatform.isx86_64)