I am reanimating a PowerMac 11.2, based on Power5 (970) Big endian CPU. emerge rust fails: emerge -av --autounmask-write =rust-1.33.0 !!! Repository 'x-portage' is missing masters attribute in '/usr/local/portage/metadata/layout.conf' !!! Set 'masters = gentoo' in this file for future compatibility These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N #] dev-lang/rust-1.33.0:stable/1.33::gentoo USE="system-llvm -clippy -debug -doc -libressl -rls -rustfmt -wasm" LLVM_TARGETS="(PowerPC) -AArch64 -AMDGPU -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -Sparc -SystemZ -X86 -XCore" 337,337 KiB [ebuild U #] virtual/rust-1.33.0::gentoo [1.31.1::gentoo] 0 KiB Total: 2 packages (1 upgrade, 1 new), Size of downloads: 337,337 KiB !!! The following installed packages are masked: - gnome-extra/nautilus-tracker-tags-1.12.4::gentoo (masked by: package.mask) /usr/portage/profiles/package.mask: # Mart Raudsepp <leio@gentoo.org> (12 Feb 2019) # Was not well maintained upstream, dropped with tracker-2. # Removal in 30 days. Bug 677798 For more information, see the MASKED PACKAGES section in the emerge man page or refer to the Gentoo Handbook. Would you like to merge these packages? [Yes/No] >>> Verifying ebuild manifests >>> Running pre-merge checks for dev-lang/rust-1.33.0 * Checking for at least 4 GiB RAM ... [ ok ] * Checking for at least 7 GiB disk space at "/var/tmp/portage/dev-lang/rust-1.33.0/temp" ... [ ok ] >>> Emerging (1 of 2) dev-lang/rust-1.33.0::gentoo * Fetching files in the background. * To view fetch progress, run in another terminal: * tail -f /var/log/emerge-fetch.log * rustc-1.33.0-src.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ] * rust-1.32.0-powerpc64-unknown-linux-gnu.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ] * rust-1.32.0-powerpc64le-unknown-linux-gnu.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ] * Checking for at least 4 GiB RAM ... [ ok ] * Checking for at least 7 GiB disk space at "/var/tmp/portage/dev-lang/rust-1.33.0/temp" ... [ ok ] >>> Unpacking source... >>> Unpacking rustc-1.33.0-src.tar.xz to /var/tmp/portage/dev-lang/rust-1.33.0/work >>> Unpacking rust-1.32.0-powerpc64-unknown-linux-gnu.tar.xz to /var/tmp/portage/dev-lang/rust-1.33.0/work >>> Unpacking rust-1.32.0-powerpc64le-unknown-linux-gnu.tar.xz to /var/tmp/portage/dev-lang/rust-1.33.0/work >>> Source unpacked in /var/tmp/portage/dev-lang/rust-1.33.0/work >>> Preparing source in /var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src ... install: creating uninstall script at /var/tmp/portage/dev-lang/rust-1.33.0/work/rust-stage0/lib/rustlib/uninstall.sh install: installing component 'rustc' install: installing component 'cargo' install: installing component 'rls-preview' install: installing component 'rustfmt-preview' install: installing component 'llvm-tools-preview' install: installing component 'rust-analysis-powerpc64-unknown-linux-gnu' install: installing component 'rust-std-powerpc64-unknown-linux-gnu' Rust is ready to roll. * Applying 1.32.0-fix-configure-of-bundled-llvm.patch ... [ ok ] * Applying 1.33.0-clippy-sysroot.patch ... [ ok ] >>> Source prepared. >>> Configuring source in /var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src ... >>> Source configured. >>> Compiling source in /var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src ... running: /var/tmp/portage/dev-lang/rust-1.33.0/work/rust-stage0/bin/cargo build --manifest-path /var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/Cargo.toml --locked --frozen Traceback (most recent call last): File "./x.py", line 11, in <module> bootstrap.main() File "/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/bootstrap.py", line 843, in main bootstrap(help_triggered) File "/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/bootstrap.py", line 814, in bootstrap build.build_bootstrap() File "/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/bootstrap.py", line 642, in build_bootstrap run(args, env=env, verbose=self.verbose) File "/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/bootstrap.py", line 141, in run raise RuntimeError(err) RuntimeError: failed to run: /var/tmp/portage/dev-lang/rust-1.33.0/work/rust-stage0/bin/cargo build --manifest-path /var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src/src/bootstrap/Cargo.toml --locked --frozen * ERROR: dev-lang/rust-1.33.0::gentoo failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 124: Called src_compile * environment, line 4101: Called die * The specific snippet of code: * env $(cat "${S}"/config.env) "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) --exclude src/tools/miri || die * * If you need support, post the output of `emerge --info '=dev-lang/rust-1.33.0::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-lang/rust-1.33.0::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-lang/rust-1.33.0/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/rust-1.33.0/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src' * S: '/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src' >>> Failed to emerge dev-lang/rust-1.33.0, Log file: >>> '/var/tmp/portage/dev-lang/rust-1.33.0/temp/build.log' * Messages for package dev-lang/rust-1.33.0: * ERROR: dev-lang/rust-1.33.0::gentoo failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 124: Called src_compile * environment, line 4101: Called die * The specific snippet of code: * env $(cat "${S}"/config.env) "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) --exclude src/tools/miri || die * * If you need support, post the output of `emerge --info '=dev-lang/rust-1.33.0::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-lang/rust-1.33.0::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-lang/rust-1.33.0/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/rust-1.33.0/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src' * S: '/var/tmp/portage/dev-lang/rust-1.33.0/work/rustc-1.33.0-src' Now, what caught my attention is this line: >>> Unpacking rust-1.32.0-powerpc64le-unknown-linux-gnu.tar.xz to /var/tmp/portage/dev-lang/rust-1.33.0/work Why big endian OS, on big endian CPU unpacks a little endian archive? PS: same error in 1.32, but 1.31 is compiling now
sorry, typo-ed, Power4 CPU
please provide emerge --info output
unpacking of le snapshot is ok. as you see later is installs be version for bootstrap. we can't just know what snapshot we gonna use at unpack stage on ppc64 and unpack both. ... install: installing component 'rust-analysis-powerpc64-unknown-linux-gnu' install: installing component 'rust-std-powerpc64-unknown-linux-gnu' I can reproduce it on ppc64 /var/tmp/notmpfs/portage/dev-lang/rust-1.32.0/work/rust-stage0 # ./bin/cargo Illegal instruction so whatever comes from upstream tarball snapshot can't run. investigating.
and looks like there is the reason. https://github.com/rust-lang/rust/pull/58986
<jrtc27> infinity0: ok I've found the problem <jrtc27> https://sources.debian.org/src/openssl/1.1.1a-1/crypto/rand/rand_unix.c/?hl=127#L286-L287 <jrtc27> on whatever old build machine upstream's cargo was linked against, there was no getentropy symbol in their libc <jrtc27> however, the linker has done stupid things <jrtc27> getting the address of getentropy for the function pointer != NULL comparison has remained, as it's loading it from the TOC (PPC's version of the GOT), and there's a dynamic relocation there to fill in the entry <jrtc27> so on stretch (or other older systems) the entry gets filled in as NULL at runtime and the condition gives false <jrtc27> but on sid, the entry is filled in with the non-NULL address for the function pointer and the condition gives true, so it then goes to actually call getentropy <jrtc27> however, the *call* to getentropy is done in the assembly as `bl getentropy`, ie not using the function pointer <jrtc27> and for whatever reason, the linker didn't create a PLT stub for that, but instead went "oh, call to non-existent weak function, that's a call to 0, ie crash" <jrtc27> so you get inconsistency <jrtc27> infinity0: I can reproduce it with jessie's binutils 2.25 using ld.bfd <jrtc27> but the linker bug appears to have been fixed by 2.28 <jrtc27> tried to find the relevant commit, but there are lots between 2.25 and 2.28 that mention undefined weak symbols, so I give up <jrtc27> anyway, point is, rust upstream just needs to not just an ancient build environment
so basically we have 2 problems 1) cargo contains getentropy symbol that needs to be gone to work on modern glibc 2) linked in openssl crashes in OPENSSL_cpuid_setup because nothing handles signal while probing cargo[5121]: unhandled signal 4 at 00000000304cd000 nip 00000000304cd000 lr 0000000030e022a4 code 30001 the fix is stupid simple 1) sed out getentropy symbol from cargo 2) set OPENSSL_ppccap to stop openssl from probing anything at all. from crypto/ppccap.c:OPENSSL_cpuid_setup( if ((e = getenv("OPENSSL_ppccap"))) { OPENSSL_ppccap_P = strtoul(e, NULL, 0); return; } testing rust ebuilds now
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5573f88f5f07123507726c1fb516e6a0b0b440f commit c5573f88f5f07123507726c1fb516e6a0b0b440f Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-03-10 08:46:03 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-03-10 08:47:09 +0000 dev-lang/rust: fix boostrap on ppc64 Bug: https://bugs.gentoo.org/679806 Thanks-to: Sergei Trofimovich <slyfox@gentoo.org> Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/rust-1.32.0.ebuild | 6 ++++++ dev-lang/rust/rust-1.33.0.ebuild | 6 ++++++ 2 files changed, 12 insertions(+)
Works fine now with the latest ebuild. Thanks!
Awesome, thanks for testing. Now I need to fix rust-bin, which is a bit more involved, cause it’ll require a cargo wrapper
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e428d13d6870832812748de67e48f170cbce6a5 commit 6e428d13d6870832812748de67e48f170cbce6a5 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-03-11 04:46:09 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-03-11 04:51:16 +0000 dev-lang/rust-bin: fix cargo on ppc64 Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust-bin/rust-bin-1.32.0.ebuild | 13 ++++++++++++- dev-lang/rust-bin/rust-bin-1.33.0.ebuild | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43fdc6b66fa0adbb56593bf0e74ffb8d7180f5a3 commit 43fdc6b66fa0adbb56593bf0e74ffb8d7180f5a3 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-05-24 05:18:37 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-05-24 09:02:30 +0000 dev-lang/rust-bin: bump to 1.35.0 EAPI=7 uninherit eutils Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.66, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust-bin/Manifest | 13 +++ dev-lang/rust-bin/rust-bin-1.35.0.ebuild | 161 +++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+)
so rust-bin-1.35 is free of nasty workaround and works fine on ppc64 for me rust-1.35 still has that getentropy hack but it's not a big deal, as the compiled rust is clean. leaving open until 1.36.0 lands.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22ad38aea43abc71360afc7bdbc63c26eb3e48c2 commit 22ad38aea43abc71360afc7bdbc63c26eb3e48c2 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-07-08 03:00:02 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-07-08 23:01:19 +0000 dev-lang/rust: bump to 1.36.0 couple of important fixes also it now installs i686 libs to /usr/lib/${PN} on multilib Bug: https://bugs.gentoo.org/672816 Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.68, Repoman-2.3.16 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/Manifest | 14 + dev-lang/rust/files/1.34.2-fix-custom-libdir.patch | 36 +++ dev-lang/rust/rust-1.36.0.ebuild | 325 +++++++++++++++++++++ 3 files changed, 375 insertions(+)
we no longer have affected versions. closing.