Bug 221466 - security/nss fails to build on i386
Summary: security/nss fails to build on i386
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-08-13 08:44 UTC by Bertrand Petit
Modified: 2017-12-14 17:18 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Petit 2017-08-13 08:44:06 UTC
On a 10.3 host (i386) the security/nss package looks to be in disaray, it is affected by two problems. The used ports tree was updated using portsnap a few tens of minutes before.

1/ Some patches can not be applied

# pwd
/usr/ports/security/nss
# make patch
===>  License MPL accepted by the user
===>   nss-3.32 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by nss-3.32 for building
===>  Extracting for nss-3.32
=> SHA256 Checksum OK for nss-3.32.tar.gz.
===>  Patching for nss-3.32
===>  Applying FreeBSD patches for nss-3.32
No such line 52 in input file, ignoring
No such line -11 in input file, ignoring
No such line 118 in input file, ignoring
/usr/bin/find /usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/tests -name '*.sh' | /usr/bin/xargs /usr/bin/grep -l -F '/bin/bash' |  /usr/bin/xargs /usr/bin/sed -i.bak -e 's|#! */bin/bash|#!/bin/sh|'

2/ When ignoring those patch failures the port fails to build.

# make
[...]
gmake[5]: Entering directory '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/mangle'
../../../coreconf/nsinstall/FreeBSD10.3_OPT.OBJ/nsinstall -R -m 775 FreeBSD10.3_OPT.OBJ/mangle ../../../../dist/FreeBSD10.3_OPT.OBJ/bin
gmake[5]: Leaving directory '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/mangle'
cd FreeBSD10.3_OPT.OBJ ; sh '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/.'/sign.sh '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/../../../dist/FreeBSD10.3_OPT.OBJ' \
'/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/FreeBSD10.3_OPT.OBJ' FreeBSD \
'/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/../../../dist/FreeBSD10.3_OPT.OBJ/lib' '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/../../../dist/FreeBSD10.3_OPT.OBJ/lib/libsoftokn3.so'
/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/FreeBSD10.3_OPT.OBJ/shlibsign -v -i /usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign/../../../dist/FreeBSD10.3_OPT.OBJ/lib/libsoftokn3.so
moduleSpec configdir='' certPrefix='' keyPrefix='' secmod='' flags=noCertDB, noModDB
Illegal instruction (core dumped)
gmake[4]: *** [Makefile:92: ../../../dist/FreeBSD10.3_OPT.OBJ/lib/libsoftokn3.chk] Error 132
gmake[4]: Leaving directory '/usr/obj/ports/usr/ports/security/nss/work/nss-3.32/nss/cmd/shlibsign'
[...]
Comment 1 Jan Beich freebsd_committer 2017-08-13 11:00:08 UTC
Does your CPU support SSE2? If not this is probably upstream regression since 3.32.
Comment 2 Bertrand Petit 2017-08-13 11:45:51 UTC
(In reply to Jan Beich from comment #1)
Indeed, it does not support the SSE2 instructions, here are the boot messages:

CPU: AMD Sempron(tm)   3000+ (1999.82-MHz 686-class CPU)
  Origin="AuthenticAMD"  Id=0x6a0  Family=0x6  Model=0xa  Stepping=0
Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
  AMD Features=0xc0480800<SYSCALL,MP,MMX+,3DNow!+,3DNow!>
Comment 3 commit-hook freebsd_committer 2017-10-04 07:52:06 UTC
A commit references this bug:

Author: jbeich
Date: Wed Oct  4 07:51:05 UTC 2017
New revision: 451183
URL: https://svnweb.freebsd.org/changeset/ports/451183

Log:
  security/nss: fix crash on pre-SSE2 hardware

  PR:		221466
  Obtained from:	upstream

Changes:
  head/security/nss/Makefile
  head/security/nss/files/patch-bug1400603
Comment 4 commit-hook freebsd_committer 2017-10-04 07:54:10 UTC
A commit references this bug:

Author: jbeich
Date: Wed Oct  4 07:53:36 UTC 2017
New revision: 451184
URL: https://svnweb.freebsd.org/changeset/ports/451184

Log:
  MFH: r451183

  security/nss: fix crash on pre-SSE2 hardware

  PR:		221466
  Obtained from:	upstream
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q4/
  branches/2017Q4/security/nss/Makefile
  branches/2017Q4/security/nss/files/patch-bug1400603
Comment 5 Jan Beich freebsd_committer 2017-10-04 07:56:06 UTC
Bertrand, can you confirm the port now builds and runs fine on your hardware?
Comment 6 Bertrand Petit 2017-10-04 09:00:45 UTC
(In reply to Jan Beich from comment #5)
I confirm that security/nss now compiles on i386 hardware. Thank you for this fix.
Comment 7 Mikhail T. 2017-12-14 04:07:12 UTC
First, if the problem really is due to SSE2-features missing on the build-machine, the test should be further tightened:

-.if ${OPSYS} == FreeBSD && ${ARCH} == i386
+.if ${OPSYS} == FreeBSD && ${ARCH} == i386 && ${MACHINE_CPU:Msse2} == ""

This would allow a vast number of machines to still build nss without building a whole new compiler first.

Second, if this is an upstream bug, should we not, perhaps, patch it?

How is it, that FreeBSD's base C-compiler is unable to compile nss?
Comment 8 Mikhail T. 2017-12-14 04:11:58 UTC
Perhaps more importantly, the upstream bug 1400603 is fixed:

https://bugzilla.mozilla.org/show_bug.cgi?id=1400603

and, indeed, our port no longer carries the files/patch-bug1400603 . Should not the requirement for a special compiler be lifted unconditionally then?
Comment 9 Jan Beich freebsd_committer 2017-12-14 05:36:04 UTC
No, SSE2 code is always built but disabled at runtime via CPUID check. I don't plan to spend time working around Clang 3.4 on FreeBSD 10.* lacking
https://llvm.org/viewvc/llvm-project?view=revision&revision=239883

In file included from gcm.c:12:
In file included from ./gcm.h:21:
/usr/include/clang/3.4.1/emmintrin.h:28:2: error: "SSE2 instruction set not enabled"
#error "SSE2 instruction set not enabled"
 ^
In file included from gcm.c:12:
./gcm.h:63:5: error: unknown type name '__m128i'
    __m128i x, h;
    ^
2 errors generated.
Comment 10 Mikhail T. 2017-12-14 12:32:03 UTC
Well, you certainly should be able to find time to add the SSE2-check I proposed.

I built nss just fine that way yesterday on 10.4/i386 - with -march=native - using the base compiler.
Comment 11 commit-hook freebsd_committer 2017-12-14 17:18:14 UTC
A commit references this bug:

Author: jbeich
Date: Thu Dec 14 17:17:12 UTC 2017
New revision: 456314
URL: https://svnweb.freebsd.org/changeset/ports/456314

Log:
  MFH: r456313

  security/nss: don't pull llvm40 on 10.* i386 if CPUTYPE is set

  PR:		221466
  Submitted by:	mi
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q4/
  branches/2017Q4/security/nss/Makefile