Darwin aarch64 results in wrong target arch
Categories
(NSS :: Build, defect)
Tracking
(Not tracked)
People
(Reporter: uilianries, Unassigned)
Details
Attachments
(2 files)
|
6.70 KB,
text/x-log
|
Details | |
|
387 bytes,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0
Steps to reproduce:
wget https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_93_RTM/src/nss-3.93.tar.gz
tar zxf nss-3.93.tar.gz
cd nss-3.93/nss/
make USE_64=1 CPU_ARCH=aarch64 NSPR_INCLUDE_DIR=/.../include/nspr NSPR_LIB_DIR=/.../lib OS_TARGET=Darwin OS_ARCH=Darwin BUILD_OPT=1 USE_SYSTEM_ZLIB=1 ZLIB_INCLUDE_DIR=/.../include ZLIB_LIBS=-lz -L/.../lib" NSS_DISABLE_GTESTS=1 NSS_USE_SYSTEM_SQLITE=1 SQLITE_INCLUDE_DIR=/.../include SQLITE_LIB_DIR=/.../lib NSDISTMODE=copy NSS_ENABLE_WERROR=0 CROSS_COMPILE=1 V=1 NSS_DISABLE_AVX2=1 DIST=/tmp/install/dist SOURCE_PREFIX=/tmp/install/dist SOURCE_MD_DIR=tmp/install/dist
Actual results:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C coreconf/nsinstall program
cc -arch ppc -o Darwin24.3.0_64_OPT.OBJ/nsinstall.o -c -std=c99 -O2 -fPIC -Dppc -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_DISABLE_AVX2 -DNSS_DISABLE_SSE3 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/Users/uilian/.conan2/p/b/nspr87572bb4a62d3/p/include/nspr -I/Users/uilian/.conan2/p/b/nss292069a61d10e/b/build-release/dist/include -I/Users/uilian/.conan2/p/b/nss292069a61d10e/b/build-release/dist/public/coreconf -I/Users/uilian/.conan2/p/b/nss292069a61d10e/b/build-release/dist/private/coreconf nsinstall.c
nsinstall.c:8:10: fatal error: 'stdio.h' file not found
8 | #include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
| ^~~~~~~~~
1 error generated.
make[1]: *** [Darwin24.3.0_64_OPT.OBJ/nsinstall.o] Error 1
make: *** [prepare_build] Error 2
Expected results:
The file nss/coreconf/Darwin.mk has some conditions to check which cflags should be passed to the compiler based on the cpu architecture. It has a support for x86_64 and arm (not aarch64), anything different will be considered as ppc (PowerPC).
For Mac M1 or later (using armv8 family), the correct CPU_ARCH should be aarch64, not arm. Using arm instead of aarch64 will pass this first condition, but will fail later, because will expect arm-neon support, missing __ARM_FEATURE_CRYPTO feature.
In order to fix this current situation the Makefile could skip the validation for aarch64 as well:
diff --git a/nss/coreconf/Darwin.mk b/nss/coreconf/Darwin.mk
index 0569e18..021a001 100644
--- a/nss/coreconf/Darwin.mk
+++ b/nss/coreconf/Darwin.mk
@@ -33,6 +33,9 @@ else
ifeq (arm,$(CPU_ARCH))
# Nothing set for arm currently.
else
+ifeq (aarch64,$(CPU_ARCH))
+# Nothing set for arm currently.
+else
OS_REL_CFLAGS = -Dppc
CC += -arch ppc
CCC += -arch ppc
| Reporter | ||
Comment 1•1 year ago
|
||
Changed the Darwin.mk to skip extra cflags when building for aarch64, usually, Mac M1.
Updated•9 months ago
|
Updated•4 months ago
|
Description
•