Opened 3 years ago

Closed 2 years ago

#64900 closed defect (fixed)

nspr and nss do not respect macports.conf arch settings on 10.6.8 Rosetta

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc, snowleopard, rosetta Cc:
Port: nspr, nss

Description

I guess this is the first time I see arch flags get wrong. Despite macports.conf setting to build for ppc, nspr forces i386:

make[1]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_nspr/nspr/work/nspr-4.33/nspr/config'
/usr/bin/gcc-4.2 -arch i386 -o now.o -c    -I/opt/local/include -pipe -Os -arch ppc -Wall -fno-common -pthread -Os -fPIC  -UDEBUG -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DNDEBUG=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DHAVE_POINTER_LOCALTIME_R=1 -DHAVE_CRT_EXTERNS_H=1 -DHAVE_DLADDR=1 -DHAVE_LCHOWN=1 -DHAVE_SETPRIORITY=1 -DHAVE_STRERROR=1 -DHAVE_SYSCALL=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM   now.c

Adding --build=powerpc-apple-darwin10 and same for host and target in portfile solved the problem.

nss recognizes ppc but adds -Di386 flag, which leads to build failure:

/usr/bin/gcc-4.2 -Os -std=c99 -arch ppc -o Output.OBJD/Darwin_SINGLE_SHLIB/sha_fast.o -c -std=c99 -Os -fPIC -Di386 -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -DSHLIB_SUFFIX=\"dylib\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_X86_OR_X64 -DNSS_X86 -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D -DKRML_VERIFIED_UINT128 -DMP_API_COMPATIBLE -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -Iverified -Iverified/kremlin/include -Iverified/kremlin/kremlib/dist/minimal -Ideprecated  sha_fast.c
{standard input}:76:Invalid mnemonic 'bswap'
{standard input}:81:Invalid mnemonic 'bswap'
{standard input}:86:Invalid mnemonic 'bswap'
{standard input}:89:Invalid mnemonic 'bswap'
{standard input}:92:Invalid mnemonic 'bswap'
{standard input}:95:Invalid mnemonic 'bswap'
{standard input}:98:Invalid mnemonic 'bswap'
{standard input}:131:Invalid mnemonic 'bswap'
{standard input}:147:Invalid mnemonic 'bswap'
{standard input}:158:Invalid mnemonic 'bswap'
{standard input}:172:Invalid mnemonic 'bswap'
{standard input}:177:Invalid mnemonic 'bswap'
{standard input}:197:Invalid mnemonic 'bswap'
{standard input}:214:Invalid mnemonic 'bswap'
{standard input}:228:Invalid mnemonic 'bswap'
{standard input}:242:Invalid mnemonic 'bswap'
{standard input}:256:Invalid mnemonic 'bswap'
{standard input}:269:Invalid mnemonic 'bswap'
{standard input}:283:Invalid mnemonic 'bswap'
{standard input}:297:Invalid mnemonic 'bswap'
{standard input}:311:Invalid mnemonic 'bswap'
{standard input}:326:Invalid mnemonic 'bswap'
{standard input}:340:Invalid mnemonic 'bswap'
{standard input}:1811:Invalid mnemonic 'bswap'
{standard input}:1814:Invalid mnemonic 'bswap'
{standard input}:1817:Invalid mnemonic 'bswap'
{standard input}:1820:Invalid mnemonic 'bswap'
{standard input}:1823:Invalid mnemonic 'bswap'
make[4]: *** [Output.OBJD/Darwin_SINGLE_SHLIB/sha_fast.o] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.76/nss/lib/freebl'
make[3]: *** [freebl_FREEBL_BUILD_SINGLE_SHLIB] Error 2
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.76/nss/lib/freebl'
make[2]: *** [freebl] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.76/nss/lib'
make[1]: *** [lib] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.76/nss'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.76/nss'

In this case specifying the triple does not help, nss still fails.

Attachments (1)

main.log (357.2 KB) - added by barracuda156 3 years ago.
nss failure

Download all attachments as: .zip

Change History (6)

Changed 3 years ago by barracuda156

Attachment: main.log added

nss failure

comment:1 Changed 2 years ago by barracuda156

Adding the following solves the wrong arch problem:

platform darwin 10 {
    if {${build_arch} eq "ppc"} {
    # Otherwise -Di386 flag is added and build fails. See nss/coreconf/Darwin.mk
        build.env-append CPU_ARCH=ppc
    }
}

Then the build fails on:

cc1: error: unrecognized command line option "-mcrypto"
cc1: error: unrecognized command line option "-mvsx"
make[4]: *** [Output.OBJD/Darwin_SINGLE_SHLIB/sha512.o] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss/lib/freebl'
make[3]: *** [freebl_FREEBL_BUILD_SINGLE_SHLIB] Error 2
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss/lib/freebl'
make[2]: *** [freebl] Error 2

comment:2 Changed 2 years ago by barracuda156

After blacklisting *gcc-4.* (and using gcc12), build still fails, but later on:

C_Initialize failed: 0x00000030, CKR_DEVICE_ERROR                    
NSPR error code: -5977: Failure to load dynamic library
Initiailzing softoken failed: 0x00000030, CKR_DEVICE_ERROR                    
NSPR error code: -5977: Failure to load dynamic library
moduleSpec configdir='' certPrefix='' keyPrefix='' secmod='' flags=noCertDB, noModDB
make[4]: *** [../../../dist/Output.OBJD/lib/libsoftokn3.chk] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss/cmd/shlibsign'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss/cmd/shlibsign'
make[2]: *** [shlibsign] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss/cmd'
make[1]: *** [cmd] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCRosettaPorts_net_nss/nss/work/nss-3.81/nss'
make: *** [all] Error 2

comment:3 Changed 2 years ago by barracuda156

Ok, this patch apparently fixes the problem:

--- nss/coreconf/Darwin.mk.orig	2022-07-21 19:11:57.000000000 +0545
+++ nss/coreconf/Darwin.mk	2022-08-04 15:40:28.000000000 +0545
@@ -29,16 +29,29 @@
 CCC             += -arch i386
 override CPU_ARCH	= x86
 endif
-else
+endif
+
 ifeq (arm,$(CPU_ARCH))
 # Nothing set for arm currently.
-else
+endif
+
+ifeq (,$(filter-out ppc ppc64,$(CPU_ARCH)))
 OS_REL_CFLAGS	= -Dppc
+ifdef USE_64
+CC              += -arch ppc64
+CCC             += -arch ppc64
+else
 CC              += -arch ppc
 CCC             += -arch ppc
 endif
 endif
 
+ifeq (,$(filter-out ppc ppc64,$(CPU_ARCH)))
+ifneq ($(NSS_DISABLE_CRYPTO_VSX),0)
+	NSS_DISABLE_CRYPTO_VSX=1
+endif
+endif
+
 ifneq (,$(MACOS_SDK_DIR))
     GCC_VERSION_FULL := $(shell $(CC) -dumpversion)
     GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$1 }')

Then gcc-4.2 can be used, no need to blacklist. Cannot test ppc64 now, but likely this is correct.

comment:5 Changed 2 years ago by barracuda156

Owner: set to barracuda156
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.