Skip to content

Commit 2ebfb5d

Browse files
committed
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.
1 parent e1b42aa commit 2ebfb5d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libs/build-nss-desktop.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ elif [[ -n "${CROSS_COMPILE_TARGET}" ]]; then
3333
elif [[ "$(uname -s)" == "Darwin" ]]; then
3434
TARGET_OS="macos"
3535
# We need to set this variable for switching libs based on different macos archs (M1 vs Intel)
36+
# Also set lowercase target_arch which gyp expects
3637
if [[ "$(uname -m)" == "arm64" ]]; then
3738
DIST_DIR=$(abspath "desktop/darwin-aarch64/nss")
3839
TARGET_ARCH="aarch64"
40+
target_arch="$(uname -m)"
41+
export target_arch
3942
else
4043
DIST_DIR=$(abspath "desktop/darwin-x86-64/nss")
4144
TARGET_ARCH="x86_64"
45+
target_arch="$(uname -m)"
46+
export target_arch
4247
fi
4348
elif [[ "$(uname -s)" == "Linux" ]]; then
4449
# This is a JNA weirdness: "x86-64" rather than "x86_64".

0 commit comments

Comments
 (0)