Created attachment 850614 [details] 'emerge --info' output I'm trying to install Gentoo on an iMac G5, following the PPC64 Handbook. I started with the stage3 tarball 'stage3-ppc64-systemd-20230210T011702Z.tar.xz'. I selected the profile 'default/linux/ppc64/17.0/systemd (stable)'. While installing the base system, updating the world set fails. It says: > libtool: compile: powerpc64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-libs/pam-1.5.2-r3/work/Linux-PAM-1.5.2/libpam -I.. -DDEFAULT_MODULE_PATH=\"/lib64/security/\" -DLIBPAM_COMPILE -I/var/tmp/portage/sys-libs/pam-1.5.2-r3/work/Linux-PAM-1.5.2/libpam/include -DPAM_VERSION=\"1.5.2\" -DSYSCONFDIR=\"/etc\" -W -Wall -Wbad-function-cast -Wcast-align -Wcast-align=strict -Wcast-qual -Wdeprecated -Winline -Wmain -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wshadow -Wstrict-prototypes -Wuninitialized -Wwrite-strings -O2 -pipe -c /var/tmp/portage/sys-libs/pam-1.5.2-r3/work/Linux-PAM-1.5.2/libpam/pam_delay.c -fPIC -DPIC -o .libs/pam_delay.o > /var/tmp/portage/sys-libs/pam-1.5.2-r3/work/Linux-PAM-1.5.2/libpam/pam_delay.c: In function '_pam_compute_delay': > /var/tmp/portage/sys-libs/pam-1.5.2-r3/work/Linux-PAM-1.5.2/libpam/pam_delay.c:74:6: internal compiler error: Illegal instruction > 74 | sum = (sum/3.)/1e6 - .5; /* rescale */ > | ^~~ > 0x1172bf4b internal_error(char const*, ...) > ???:0 > 0x3f704eb3f8c4 .__gmpn_mul_1 > ???:0 I then tested building nano-6.4, and ran into a very similar error. > powerpc64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants -O2 -pipe -Wall -c -o libgnu_a-float.o `test -f 'float.c' || echo './'`float.c > float.c:25:3: internal compiler error: Illegal instruction > 25 | { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; > | ^ > 0x1172bf4b internal_error(char const*, ...) > ???:0 > 0x3f546f5df984 .__gmpn_mul_1 > ???:0 And for grep-3.8-r1: > powerpc64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants -O2 -pipe -c -o libgreputils_a-c-strncasecmp.o `test -f 'c-strncasecmp.c' || echo './'`c-strncasecmp.c > during GIMPLE pass: evrp > c-strncasecmp.c: In function 'c_strncasecmp': > c-strncasecmp.c:56:1: internal compiler error: Illegal instruction > 56 | } > | ^ > 0x1172bf4b internal_error(char const*, ...) > ???:0 > 0x3f44d602ec28 __gmpn_invert_limb > ???:0 I tried searching around, but didn't find anything useful. Seems vaguely related to libgmp? I'll attach all logs related to each package.
Created attachment 850616 [details] "emerge --info '=sys-apps/grep-3.8-r1::gentoo'" output
Created attachment 850618 [details] "emerge -pqv '=sys-apps/grep-3.8-r1::gentoo'" output
Created attachment 850620 [details] "emerge --info '=sys-libs/pam-1.5.2-r3::gentoo'" output
Created attachment 850622 [details] "emerge -pqv '=sys-libs/pam-1.5.2-r3::gentoo'" output
Created attachment 850624 [details] "emerge --info '=app-editors/nano-6.4::gentoo'" output
Created attachment 850626 [details] "emerge -pqv '=app-editors/nano-6.4::gentoo'" output
Created attachment 850644 [details] grep-3.8-r1 build.log
Created attachment 850646 [details] grep-3.8-r1 environment
Created attachment 850648 [details] pam-1.5.2-r3 build.log
Created attachment 850650 [details] pam-1.5.2-r3 environment
Created attachment 850652 [details] nano-6.4 build.log
Created attachment 850654 [details] nano-6.4 environment
This is too many coincidences now. This has got to be related to the changes we made for gmp in bug 883201. If it's not a defect in those changes, my only guess is that when stage building, we're doing USE=-cpudetection..
In releng.git: ``` commit 5378e83aab46e53b3bbeb72d45f91024155ab878 (HEAD -> master, origin/master, origin/HEAD) Author: Andreas K. Hüttel <dilfridge@gentoo.org> Date: Sat Feb 18 13:18:07 2023 +0100 Test enabling cpudetection for gmp, for bug 894134 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> ``` For now, could you try downgrade gmp (or ememrge it with USE=cpudetection)?
I started from the 2/15/ I tried to build gmp-6.2.1-r5 USE="cpudetection", and it failed while configuring source with: > checking ABI=mode64 > checking whether powerpc64-unknown-linux-gnu-gcc is gcc... yes > checking compiler powerpc64-unknown-linux-gnu-gcc -O2 -pipe ... no, long long reliability test 1 > checking ABI=mode32 > checking whether powerpc64-unknown-linux-gnu-gcc is gcc... yes > checking compiler powerpc64-unknown-linux-gnu-gcc -O2 -pipe ... no, long long reliability test 1 > checking ABI=32 > checking whether powerpc64-unknown-linux-gnu-gcc is gcc... yes > checking compiler powerpc64-unknown-linux-gnu-gcc -O2 -pipe ... no, long long reliability test 1 > configure.wrapped: error: could not find a working compiler, see config.log for details Looking into the config.log: > Test compile: long long reliability test 1 > configure.wrapped:6543: powerpc64-unknown-linux-gnu-gcc -O2 -pipe conftest.c >&5 > during GIMPLE pass: ldist > conftest.c: In function 'f': > conftest.c:11:6: internal compiler error: Illegal instruction > 11 | void f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i; > | ^ > 0x1172bf4b internal_error(char const*, ...) > ???:0 > 0x3fee9bcfec28 __gmpn_invert_limb > ???:0 I then tried to downgrade to gmp-6.2.1-r1, and got the same error. I then just tried to rebuild gmp-6.2.1-r5 without cpudetection, again, same error. I'll attach the gmp-6.2.1-r5 cpudetection info/logs.
Created attachment 852708 [details] "emerge --info '=dev-libs/gmp-6.2.1-r5::gentoo'" output
Created attachment 852710 [details] "emerge -pqv '=dev-libs/gmp-6.2.1-r5::gentoo'" output
Created attachment 852712 [details] gmp-6.2.1-r5 environment
Created attachment 852714 [details] gmp-6.2.1-r5 build.log
Created attachment 852716 [details] gmp-6.2.1-r5 config.log
*** Bug 895964 has been marked as a duplicate of this bug. ***
From David at https://bugs.gentoo.org/895964#c0: """ The binary of dev-libs/gmp included in stage3-ppc64-openrc-20230220T024702Z.tar.xz triggers SIGILL in __gmpn_invert_limb when running gcc on an e6500 (Freescale T4240) CPU. Not all uses of gcc trigger the issue, presumably that math function is only used in specific circumstances. Trying to build sys-devel/gcc triggers the issue reliably. This is on a 5.15 kernel with math emulation for unimplemented math functions *enabled*. (The e6500 does not have FSQRT.) I haven't tracked down yet what instruction exactly is causing the issue; I ended up overwriting libgmp with a binary from Debian to get gcc working so I could rebuild dev-libs/gmp (which then worked as expected - no issue with the ebuild itself.) It seems that this is simply an issue of the stage3 tarball being built with too aggressive CPU flags. As I was under time pressure to get the setup running, I'll circle back to grab additional information in a few days. (I can of course simply grab the stage tarball again, unpack it in a fresh directory on the now-working system, and run gcc inside that to reproduce the problem. Just need to get the box up&running otherwise first, sorry.) Reproducible: Always Steps to Reproduce: 1. acquire an e6500 powerpc64 system or try emulating one with QEMU 2. grab stage3-ppc64-openrc-20230220T024702Z.tar.xz 3. emerge sys-devel/gcc Actual Results: SIGILL during build. Expected Results: sys-devel/gcc being built. # uname -a Linux zehir 5.15.71+ #9 SMP Sun Feb 19 07:51:53 CET 2023 ppc64 GNU/Linux # gunzip -c /proc/config.gz | grep MATH CONFIG_MATH_EMULATION=y # CONFIG_MATH_EMULATION_FULL is not set CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y # tail -n8 /proc/cpuinfo processor : 23 cpu : e6500, altivec supported clock : 1666.666650MHz revision : 2.0 (pvr 8040 0120) timebase : 45833333 platform : CoreNet Generic model : fsl,T4240QDS """ The next set of stages _should_ be fine, but if not, we'll need to do more.
(In reply to Sam James from comment #22) > The next set of stages _should_ be fine, but if not, we'll need to do more. That was quick, Thanks! I'll retry to confirm when they become available. If it still fails, at least now I have a sys-devel/gdb to get more info about the crash. Also, no idea why I didn't find this bug, I did search for dev-libs/gmp... Apologies for the duplicate!
Just to confirm this problem exists in stage3-ppc64-systemd-20230220T024702Z.tar.xz Verified on iMac G5 Verified on IBM pSeries POWER7 QEMU/KVM virtual machine The latter gives: /var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1/libtextstyle/lib/printf-frexp.c:104:11: internal compiler error: Illegal instruction 104 | for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); | ^~~ 0x1172bf4b internal_error(char const*, ...) ???:0 0x3f3e5e68fc0c .__gmpn_submul_1 ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug).
I've been tested this issue and Sam is correct with -cpudetection being the cause. The workaround I used to get around it from a fresh stage3 (stage3-ppc64-systemd-20230225T031702Z.tar.xz) (Using my amd64 machine running Gentoo) 1. emerge -va crossdev 2. crossdev -s4 powerpc64-unknown-linux-gnu 3. edit /usr/powerpc64-unknown-linux-gnu/etc/portage/make.conf and add USE="cpudetection" 3. emerge -va dev-libs/gmp 4. transfer gmp-6.2.1-r5-1.xpak from /usr/powerpc64-unknown-linux-gnu/var/cache/binpkgs/dev-libs/gmp to the PPC64 machine and place it in /var/cache/binpkgs/dev-libs/gmp (on the PPC64 machine) 5. edit /etc/portage/make.conf and add PKGDIR="/var/cache/binpkgs" 6. edit /etc/portage/profile/use.mask and add -cpudetection 7. emerge -vaK dev-libs/gmp This will then get the system working for any user finding the issue today. As a fix for Gentoo itself it looks like a fix we applied for mplayer is causing the issue so making it only apply to mplayer or if not just masking mplayer on ppc so it's not needed would solve this in future builds. See https://github.com/gentoo/gentoo/blob/master/profiles/arch/powerpc/ppc64/use.mask#L36
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=935f64c522978b3f18349c06dac9aac54cb0ba7b commit 935f64c522978b3f18349c06dac9aac54cb0ba7b Author: Sam James <sam@gentoo.org> AuthorDate: 2023-02-26 19:23:50 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-26 19:24:13 +0000 profiles/arch/powerpc/ppc64: shift cpudetection mask into p.use.mask Otherwise, this affects gmp[cpudetection]. This seems to be because the mask predated package.use.mask support...? Bug: https://bugs.gentoo.org/234629 Bug: https://bugs.gentoo.org/894134 Thanks-to: Ian Jordan <immoloism@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> profiles/arch/powerpc/ppc64/package.use.mask | 3 +++ profiles/arch/powerpc/ppc64/use.mask | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-)