From 2ebfb5d05882926b1f9996bf88f02eb5c37f5570 Mon Sep 17 00:00:00 2001 From: groovecoder <71928+groovecoder@users.noreply.github.com> Date: Wed, 16 Apr 2025 10:17:52 -0500 Subject: [PATCH] fix(build): set target_arch to fix NSS build on Apple Silicon GYP expects the `target_arch` environment variable to determine the correct architecture when building NSS. On Apple Silicon, if this is unset or misconfigured, NSS can be built for `x86_64`, leading to linker failures due to architecture mismatch. This patch sets `target_arch` based on `uname -m` when building on macOS, ensuring correct architecture selection and avoiding these build errors. --- libs/build-nss-desktop.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/build-nss-desktop.sh b/libs/build-nss-desktop.sh index 585fb35c11..cc1cc3083e 100755 --- a/libs/build-nss-desktop.sh +++ b/libs/build-nss-desktop.sh @@ -33,12 +33,17 @@ elif [[ -n "${CROSS_COMPILE_TARGET}" ]]; then elif [[ "$(uname -s)" == "Darwin" ]]; then TARGET_OS="macos" # We need to set this variable for switching libs based on different macos archs (M1 vs Intel) + # Also set lowercase target_arch which gyp expects if [[ "$(uname -m)" == "arm64" ]]; then DIST_DIR=$(abspath "desktop/darwin-aarch64/nss") TARGET_ARCH="aarch64" + target_arch="$(uname -m)" + export target_arch else DIST_DIR=$(abspath "desktop/darwin-x86-64/nss") TARGET_ARCH="x86_64" + target_arch="$(uname -m)" + export target_arch fi elif [[ "$(uname -s)" == "Linux" ]]; then # This is a JNA weirdness: "x86-64" rather than "x86_64".