Created attachment 504448 [details] emerge --info Hi, When attempting to build nss on my K6-2+ [1] system, the build fails partway through when it tries to run a just-built executable, which gives an Illegal instruction error: /var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/./coreconf/nsinstall/Linux4.13_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/nsinstall -t -m 775 Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/mangle ../../../dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/bin make[3]: Leaving directory '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/mangle' cd Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ ; sh '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/.'/sign.sh '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/../../dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ' \ '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ' Linux \ '/var/tmp/portage/dev-libs/nss-3.33/temp/fakedir' '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/../../dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/lib/libsoftokn3.so' /var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/./sign.sh: line 36: cd: /var/tmp/portage/dev-libs/nss-3.33/temp/fakedir: No such file or directory /var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/shlibsign -v -i /var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/../../dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/lib/libsoftokn3.so /var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign/./sign.sh: line 13: 30345 Illegal instruction (core dumped) "${2}"/shlibsign -v -i "${5}" make[2]: *** [Makefile:92: ../../dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/lib/libsoftokn3.chk] Error 132 make[2]: Leaving directory '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd/shlibsign' make[1]: *** [../coreconf/rules.mk:101: libs] Error 2 make[1]: Leaving directory '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/cmd' make: *** [coreconf/rules.mk:101: libs] Error 2 make: Leaving directory '/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86' In the system logs, I see this: Nov 12 19:33:43 mai kernel: traps: shlibsign[852] trap invalid opcode ip:b7aaceb6 sp:bf89c3d4 error:0 in libfreebl3.so[b7aa3000+81000] Nov 12 19:33:44 mai systemd-coredump[854]: Process 852 (shlibsign) of user 250 dumped core. Stack trace of thread 852: #0 0x00000000b7aaceb6 n/a (/var/tmp/portage/dev-libs/nss-3.33/work/nss-3.33/nss-abi_x86_32.x86/dist/Linux2.6_x86_i586-pc-linux-gnu-gcc_glibc_PTH_OPT.OBJ/lib/libfreebl3.so) I'm using CFLAGS="-march=i586 -mtune=k6-3 -O2 -pipe" CHOST="i586-pc-linux-gnu" which should be safe options for this processor (emerge --info attached). Note that if I manually build nss using the instructions from here: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Sources_Building_Testing Then the build is successful, and the test suite runs ok. This makes me think that the issue is due to something the gentoo ebuild is doing. 1) Note that the K6-2+ is a die-shrunk K6-III with half the on-die cache disabled. The Linux kernel identifies it as a K6-III.
This line looks suspicious. https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/nss/nss-3.33.ebuild#n118
There are bits of code in NSS that expect SSE2, iirc; that said, freebsd seems to have patches that get around it, i'm looking into that now.
As I mentioned, manually building vanilla nss (using "make nss_build_all BUILD_OPT=1" from a source checkout made yesterday) does appear to work correctly on this machine - I'm currently running the test suite from that build, and it's gotten a significant part of the way through without any errors.
when you built it by hand you fed it the same CFLAGS, CC, etc as what emerge would? If not, could you try again?
I haven't been able to figure out how to convince the nss build system to use specific CFLAGS/CXXFLAGS values (my initial attempt overrode some require include paths, causing a quick build failure). If you have any hints, please let me know.
After reading some makefiles, I'm now running this command to do a fresh build: CC=i586-pc-linux-gnu-gcc CCC=i586-pc-linux-gnu-g++ CFLAGS="-march=i586 -mtune=k6-3 -O2 -pipe" CXXFLAGS="-march=i586 -mtune=k6-3 -O2 -pipe" XCFLAGS="-march=i586 -mtune=k6-3 -O2 -pipe" make nss_build_all I'll let you know the result once it finishes (with a 500mhz single-core, this will take a while).
Alright, so when I manually compile nss using the same CFLAGS and compiler as emerge was using, I am getting the exact same build error as a result. I guess that means it is an upstream problem :/
This actually seems to have been solved upstream with nss 3.34! I notice that the ebuild has RESTRICT="test", so I'm not sure how to run the test suite to make sure, but at least the build no longer fails!
(In reply to Calvin Walton from comment #8) > This actually seems to have been solved upstream with nss 3.34! I notice > that the ebuild has RESTRICT="test", so I'm not sure how to run the test > suite to make sure, but at least the build no longer fails! You may need to temporarily modify the ebuild to remove that restriction, and then you can run 'ebuild nss-3.34.ebuild digest clean test' to determine if tests pass or not. Alternatively, ebuild nss-3.34.ebuild compile, then cd ${S} and 'make test' or whatever the command is to run the test suite by hand. If 3.34 is good for you then we'll just drop 3.33 and consider this bug resolved/upstream.
After some further testing, it's looking like nss 3.34 is working properly for me, thanks. My next goal is gonna be getting rustc working, but that's a matter for another bug ;)
Thanks for the report!