Bug 249053 - security/nss: fails to build on aarch64
Summary: security/nss: fails to build on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-01 14:59 UTC by Renato Botelho
Modified: 2020-09-14 17:05 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (gecko)


Attachments
v1 (1.36 KB, patch)
2020-09-03 14:46 UTC, Mikael Urankar
no flags Details | Diff
v2 (5.36 KB, patch)
2020-09-09 11:51 UTC, Mikael Urankar
jbeich: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Renato Botelho freebsd_committer 2020-09-01 14:59:53 UTC
It seems similar to #225326. Relevant lines of log

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
gmake[5]: *** [Makefile:92: ../../../dist/FreeBSD12.1_OPT.OBJ/lib/libsoftokn3.chk] Error 1
gmake[5]: *** Waiting for unfinished jobs....
rm -f FreeBSD12.1_OPT.OBJ/certutil
/nxb-bin/usr/bin/cc -o FreeBSD12.1_OPT.OBJ/certutil -O2 -pipe  -I/usr/local/include/nspr -Wno-error=unused-function -fstack-protector-strong -fno-strict-aliasing   -fPIC -Wall -Wno-switch -DFREEBSD -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 -D_THREAD_SAFE -D_REENTRANT -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I./../dist/FreeBSD12.1_OPT.OBJ/include -I./../dist/public/ -I./../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD -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 -D_THREAD_SAFE -D_REENTRANT -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I./../dist/FreeBSD12.1_OPT.OBJ/include -I./../dist/public/ -I./../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD -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 -D_THREAD_SAFE -D_REENTRANT -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../dist/FreeBSD12.1_OPT.OBJ/include -I../../dist/public/ -I../../dist/private/ -I../../dist/public/nss -I../../dist/public/nspr -I../../dist/public/libdbm -I../../dist/FreeBSD12.1_OPT.OBJ/../public/security -I./include    -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -DNSS_NO_GCC48 -DXP_UNIX -DNSPR20 -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../../dist/FreeBSD12.1_OPT.OBJ/include -I../../../dist/public/nss  -I../../../dist/private/nss  -I../../../dist/public/dbm -I../../../dist/public/seccmd  FreeBSD12.1_OPT.OBJ/certext.o FreeBSD12.1_OPT.OBJ/certutil.o FreeBSD12.1_OPT.OBJ/keystuff.o  -fstack-protector-strong  ../../../dist/FreeBSD12.1_OPT.OBJ/lib/libsectool.a  -L../../../dist/FreeBSD12.1_OPT.OBJ/lib -L../../../dist/FreeBSD12.1_OPT.OBJ/lib -lnssutil3 -L/usr/local/lib -lplc4 -lplds4 -lnspr4  -lssl3 -lsmime3 -lnss3 -pthread
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
gmake[4]: Leaving directory '/wrkdirs/usr/ports/security/nss/work/nss-3.56/nss/cmd/pk11gcmtest'
gmake[4]: Entering directory '/wrkdirs/usr/ports/security/nss/work/nss-3.56/nss/cmd/strsclnt'
moduleSpec configdir='' certPrefix='' keyPrefix='' secmod='' flags=noCertDB, noModDB
gmake[5]: *** [Makefile:92: ../../../dist/FreeBSD12.1_OPT.OBJ/lib/libfreebl3.chk] Error 1
gmake[4]: Leaving directory '/wrkdirs/usr/ports/security/nss/work/nss-3.56/nss/cmd/pk12util'
rm -f FreeBSD12.1_OPT.OBJ/sdrtest

Full log can be found at https://bast.garga.net.br/data/12-aarch64-default/2020-09-01_08h45m18s/logs/errors/nss-3.56.log
Comment 1 Mikael Urankar freebsd_committer 2020-09-02 13:30:52 UTC
I put some dlerror() in devel/nspr (nspr/pr/src/linking/prlink.c), here are the logs:
/usr/ports/security/nss/work/nss-3.56/nss/cmd/shlibsign/FreeBSD13.0_OPT.OBJ/shlibsign -v -i /usr/ports/security/nss/work/nss-3.56/nss/cmd/shlibsign/../../../dist/FreeBSD13.0_OPT.OBJ/lib/libsoftokn3.so
Error 0.2: Undefined symbol "nspr_use_zone_allocator"
moduleSpec configdir='' certPrefix='' keyPrefix='' secmod='' flags=noCertDB, noModDB
Error 3: /usr/ports/security/nss/work/nss-3.56/nss/cmd/shlibsign/../../../dist/FreeBSD13.0_OPT.OBJ/lib/libfreeblpriv3.so: Undefined symbol "gcm_HashInit_hw"
Error 3: Cannot open "../../../nss/lib/softoken/FreeBSD13.0_OPT.OBJ/libfreeblpriv3.so"
Error 3: /usr/ports/security/nss/work/nss-3.56/nss/cmd/shlibsign/../../../dist/FreeBSD13.0_OPT.OBJ/lib/libfreeblpriv3.so: Undefined symbol "gcm_HashInit_hw"
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

gcm_HashInit_hw is implemented in gcm-aarch64.c but is not compiled for aarch64/FreeBSD

I'm still digging...
Comment 2 Mikael Urankar freebsd_committer 2020-09-02 13:33:31 UTC
(In reply to Mikael Urankar from comment #1)
It seems to build with NS_USE_GCC = 1 in nss/coreconf/FreeBSD.mk
Comment 3 Mikael Urankar freebsd_committer 2020-09-02 13:37:33 UTC
(In reply to Mikael Urankar from comment #2)
regressed with https://github.com/nss-dev/nss/commit/189d45b71fc004d8737e000987038fe1ffa857b4

*sigh*
Comment 4 Mikael Urankar freebsd_committer 2020-09-02 13:39:26 UTC
It builds for me (only tried 13-current) with:

@@ -20,7 +21,21 @@ endif
 ifeq ($(CPU_ARCH),amd64)
 CPU_ARCH               = x86_64
 endif
+ifneq (,$(filter arm%, $(CPU_ARCH)))
+CPU_ARCH               = arm
+endif
+ifneq (,$(filter powerpc%, $(CPU_ARCH)))
+CPU_ARCH               = ppc
+endif
 
+ifeq ($(CPU_ARCH),aarch64)
+NS_USE_GCC = 1
+endif

<snip>
Comment 5 Mikael Urankar freebsd_committer 2020-09-02 18:01:41 UTC
https://bugzilla.mozilla.org/show_bug.cgi?id=1662833
Comment 6 Mikael Urankar freebsd_committer 2020-09-03 14:46:29 UTC
Created attachment 217716 [details]
v1

Can you try this patch?
Comment 7 Renato Botelho freebsd_committer 2020-09-04 12:10:28 UTC
(In reply to Mikael Urankar from comment #6)
It fixed the problem.  Thanks!
Comment 8 Mikael Urankar freebsd_committer 2020-09-09 11:51:03 UTC
Created attachment 217839 [details]
v2

use upstream patch from:
https://bugzilla.mozilla.org/show_bug.cgi?id=1659256
Comment 9 Jan Beich freebsd_committer 2020-09-09 13:02:37 UTC
Comment on attachment 217839 [details]
v2

I can confirm 12.1 aarch64 builds fine after applying the patch.
Comment 10 commit-hook freebsd_committer 2020-09-09 13:36:39 UTC
A commit references this bug:

Author: mikael
Date: Wed Sep  9 13:36:33 UTC 2020
New revision: 548091
URL: https://svnweb.freebsd.org/changeset/ports/548091

Log:
  security/nss: fix build on aarch64

  Import upstream patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1659256

  PR:		249053
  Reported by:	garga@
  Approved by:	jbeich@

Changes:
  head/security/nss/files/patch-bug1659256
Comment 11 Jan Beich freebsd_committer 2020-09-09 14:43:53 UTC
Can you MFH to 2020Q3 as well?
Comment 12 Mikael Urankar freebsd_committer 2020-09-10 08:15:19 UTC
(In reply to Jan Beich from comment #11)
I've sent an email to ports-secteam
Comment 13 Piotr Kubaj freebsd_committer 2020-09-10 18:52:27 UTC
(In reply to Mikael Urankar from comment #12)
Build fixes are under blanket approval.
Comment 14 commit-hook freebsd_committer 2020-09-14 17:04:54 UTC
A commit references this bug:

Author: mikael
Date: Mon Sep 14 17:04:04 UTC 2020
New revision: 548632
URL: https://svnweb.freebsd.org/changeset/ports/548632

Log:
  MFH: r548091

  security/nss: fix build on aarch64

  Import upstream patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1659256

  PR:		249053
  Reported by:	garga@
  Approved by:	jbeich@

  Approved by:	ports-secteam (joneum)

Changes:
_U  branches/2020Q3/
  branches/2020Q3/security/nss/files/patch-bug1659256