Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

musl-powered rust playground #1

Open
stefson opened this issue Mar 22, 2022 · 82 comments
Open

musl-powered rust playground #1

stefson opened this issue Mar 22, 2022 · 82 comments

Comments

@stefson
Copy link
Owner

stefson commented Mar 22, 2022

@ernsteiswuerfel I pushed 1.52.1 and 1.53.0

please always make a backup with quickpkg once you went up one version successfully, and please never ever use +system-llvm, you can end up in horrible and maybe unfixable circular dependency situations.

with 1.53.0 you can compile librsvg-2.52.5, firefox-96.0 and eapi8 ebuilds such as cbindgen, it seems to be a good base for now untill I figured out what to do with patch 0005-Use-static-native-libraries-when-linking-static-exec.patch for rust-1.54.0

the in tree dev-lang/rust-1.58.1 ebuild has a dist useflag, where it seems to be possible to emerge it with a freshly packed stage2 archive: Install dist tarballs (used for bootstrapping) so maybe its possible to use that for getting fresh llvm-13 based stages nativly build

@ernsteiswuerfel
Copy link

Thanks! Updating to 1.53 worked flawlessly on ppc64. cbindgen and Firefox ESR are still buildable, did not try firefox-96.0 yet.

librsvg-2.52.5 fails however.
librsvg-2.52.5:20220323-134919.log

@stefson
Copy link
Owner Author

stefson commented Mar 23, 2022

you can try this fix from alpine:
0001-fixup-system-deps-targets.patch.zip

@ernsteiswuerfel
Copy link

The patch worked librsvg-2.52.5 built fine, thanks!

@ernsteiswuerfel
Copy link

@stefson Fiddled around with the ppc build a bit. Turned out I needed only this small patch to make it build: https://github.com/void-ppc/void-packages/blob/master/srcpkgs/rust/patches/fix-ppc32.patch

It did not apply on rust-1.49.0::smaeul but this was easy to fix. Bootstrapping from 1.49.0 working fine so far with the patch. 1.50.0 done and 1.51.0 in the works. 🥳
fix-ppc32.patch.zip

@ernsteiswuerfel
Copy link

Ok, so btootstrapping up to 1.53.0 worked well with the patch on ppc32. Next I was hoping to build librsvg-2.52.5 on ppc but this failed.
librsvg-2.52.5:20220402-222802.log

Building librsvg-2.52.7 on ppc musl on the other hand succeeds.
librsvg-2.52.7:20220402-223533.log

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

I need the output of rustc -Vv and gcc -v from the powerpc-musl

@ernsteiswuerfel
Copy link

 # rustc -Vv
rustc 1.53.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: powerpc-gentoo-linux-musl
release: 1.53.0
LLVM version: 12.0.1

 # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-gentoo-linux-musl/11.2.1/lto-wrapper
Target: powerpc-gentoo-linux-musl
Configured with: /var/tmp/portage/sys-devel/gcc-11.2.1_p20220115/work/gcc-11-20220115/configure --host=powerpc-gentoo-linux-musl --build=powerpc-gentoo-linux-musl --prefix=/usr --bindir=/usr/powerpc-gentoo-linux-musl/gcc-bin/11.2.1 --includedir=/usr/lib/gcc/powerpc-gentoo-linux-musl/11.2.1/include --datadir=/usr/share/gcc-data/powerpc-gentoo-linux-musl/11.2.1 --mandir=/usr/share/gcc-data/powerpc-gentoo-linux-musl/11.2.1/man --infodir=/usr/share/gcc-data/powerpc-gentoo-linux-musl/11.2.1/info --with-gxx-include-dir=/usr/lib/gcc/powerpc-gentoo-linux-musl/11.2.1/include/g++-v11 --with-python-dir=/share/gcc-data/powerpc-gentoo-linux-musl/11.2.1/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.2.1_p20220115 p4' --disable-esp --enable-libstdcxx-time --with-build-config=bootstrap-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-multilib --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --enable-lto --without-isl --disable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.1 20220115 (Gentoo 11.2.1_p20220115 p4)

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

I did some research about this and learned that powerpc simply doesn't have AtomicI64 support, neither gnu based nor musl based rustc. Some crates work around it, others don't, but custom targets such as all of our musl based ones need to intervene here manually.

Try this approach please, its the least invasive:

diff --git a/.cargo/config b/.cargo/config
index a94e912..ccf8ea3 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -9,3 +9,6 @@ replace-with = 'vendored-sources'
 
 [source.vendored-sources]
 directory = './vendor'
+
+[target.powerpc-gentoo-linux-musl]
+rustflags = ["--cfg", "crossbeam_no_atomic_64"]

its against librsvg-2.52.5, please drop into /etc/portage/patches and report back

@ernsteiswuerfel
Copy link

With this patch librsvg-2.52.5 built without problems. Thanks!

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

I stole the idea from here: crossbeam-rs/crossbeam#731 , it might happen again for cargo-c or any other ebuild that uses the crossbeam crates, and the fix would be similar.

An alternative is to export as RUSTFLAG through /etc/portage/make.conf or on a per package based env file in /etc/portage/env/

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

I pushed rust-1.54.0 for you. please report back with positive and negative feedback.

you will need the updated patch for librsvg-2.52.6: 0001-fixup-system-deps-targets.patch.gz

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

1.53.0 at work:

firefox-91 7 1

@ernsteiswuerfel
Copy link

I pushed rust-1.54.0 for you. please report back with positive and negative feedback.

 * Applying 0016-fix-ppc32.patch ...
patching file src/bootstrap/builder.rs
Hunk #1 FAILED at 1299.

You need to take my modified version, the original one would not apply (see my comment above).

@stefson
Copy link
Owner Author

stefson commented Apr 3, 2022

I see, the merge window of the underlying change is between 1.55.0 and 1.57.0; before that it has to be backported. It was a blind shot, because I'm a bit ahead of publishing the ebuilds here and the ebuild won't let me src_prepare without a useable system-rust lol

//edit: underlying change is merged in 1.56.1

@ernsteiswuerfel
Copy link

Ok, rust-1.54.0 and librsvg-2.52.6 built fine on ppc64. 🥳 ppc coming up next...

@ernsteiswuerfel
Copy link

Success on ppc too with rust-1.54.0 and librsvg-2.52.6!

@stefson
Copy link
Owner Author

stefson commented Apr 5, 2022

I pushed 1.55.0 and 1.56.1, hopefully I didn't mess up the ppc32 patch again 🤣

1.56.1 is llvm13 based, with it you can emerge librsvg-2.54.0

please test and report back

@ernsteiswuerfel
Copy link

1.56.1 upgrade went flawless on ppc64. It did not build librsvg-2.54.0 however: librsvg-2.54.0:20220406-103703.log

I'll try ppc32 next.

@stefson
Copy link
Owner Author

stefson commented Apr 6, 2022

you forgot to forward the patch, its still needed.

@ernsteiswuerfel
Copy link

Oops... Yes, with the patch librsvg-2.54.0 builds fine!

Btw. could you add rust-1.48.0 and 1.49.0 from smaeuls overlay to yours? This way interested users could bootstrap up to 1.56.1 without the need of installing 2 overlays. Would be more convenient.

@stefson
Copy link
Owner Author

stefson commented Apr 6, 2022

honestly I'm more interested into getting the powerpc issue fixed upstream.

Do you still have the failed build log available? I forgot where you mentioned it for the first time.

@ernsteiswuerfel
Copy link

I think you mean this thread: gentoo/musl#366 (comment)

@stefson
Copy link
Owner Author

stefson commented Apr 6, 2022

the ppc32 patch only extends the whitelist to include powerpcle-* targets; but you are not on little endian, are you? could be helpfull for me if you shared the output of cpuid with me.

@ernsteiswuerfel
Copy link

No, i have all my PPC machines on BE. The Talos II which I booted into the ppc32 G4 partition (to build 1.55.0 and 1.56.1 right now) shows this data:

 # lscpu 
Architecture:          ppc64
  CPU op-mode(s):      32-bit, 64-bit
  Byte Order:          Big Endian
CPU(s):                32
  On-line CPU(s) list: 0-31
Model name:            POWER9, altivec supported
  Model:               2.2 (pvr 004e 1202)
  Thread(s) per core:  4
  Core(s) per socket:  4
  Socket(s):           2
Caches (sum of all):   
  L1d:                 256 KiB (8 instances)
  L1i:                 256 KiB (8 instances)
  L2:                  4 MiB (8 instances)
  L3:                  80 MiB (8 instances)
NUMA:                  
  NUMA node(s):        2
  NUMA node0 CPU(s):   0-15
  NUMA node8 CPU(s):   16-31
Vulnerabilities:       
  Itlb multihit:       Not affected
  L1tf:                Mitigation; RFI Flush, L1D private per thread
  Mds:                 Not affected
  Meltdown:            Mitigation; RFI Flush, L1D private per thread
  Spec store bypass:   Mitigation; Kernel entry/exit barrier (eieio)
  Spectre v1:          Mitigation; __user pointer sanitization, ori31 speculation barrier enabled
  Spectre v2:          Mitigation; Indirect branch serialisation (kernel only)
  Srbds:               Not affected
  Tsx async abort:     Not affected

 # emerge --info
Portage 3.0.30 (python 3.10.2-final-0, default/linux/ppc/17.0/musl, gcc-11.2.1, musl-1.2.2-r7, 5.16.18-gentoo-P9 ppc64)
=================================================================
System uname: Linux-5.16.18-gentoo-P9-ppc64-POWER9,_altivec_supported-with-libc
KiB Mem:    65807424 total,  49164004 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 06 Apr 2022 09:30:01 +0000
Head commit of repository gentoo: 127654ee62e16c459cb47c283df0dc5b3a8db0ab
Head commit of repository gentoo-extras: 97fd35405fdc890edeeead46f80cdf9e96a06eb7

Timestamp of repository musl: Tue, 05 Apr 2022 17:35:31 +0000
Head commit of repository musl: d3ddfddb4594435678043031a6f77493cc488f58

Timestamp of repository smaeul: Tue, 05 Apr 2022 17:35:58 +0000
Head commit of repository smaeul: 0c85f2840730b4d273121f0e17979bf5f5854586

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
distcc 3.4 powerpc-gentoo-linux-musl [disabled]
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.9.10_p1::gentoo, 3.10.2_p1::gentoo
dev-lang/rust:             1.54.0::gentoo-extras
dev-util/cmake:            3.22.2::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.4::gentoo
sys-devel/binutils:        2.37_p1-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/llvm:            13.0.1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/musl:             1.2.2-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://yea/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 2
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 24

gentoo-extras
    location: /var/db/repos/gentoo-extras
    sync-type: git
    sync-uri: https://github.com/stefson/gentoo-extras
    masters: gentoo

localrepo
    location: /var/db/repos/localrepo
    masters: gentoo

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo

smaeul
    location: /var/db/repos/smaeul
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/smaeul.git
    masters: gentoo

ACCEPT_KEYWORDS="ppc"
ACCEPT_LICENSE="*"
CBUILD="powerpc-gentoo-linux-musl"
CFLAGS="-Os -mcpu=7450 -mtune=7450 -pipe"
CHOST="powerpc-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -mcpu=7450 -mtune=7450 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-Os -mcpu=7450 -mtune=7450 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-Os -mcpu=7450 -mtune=7450 -pipe"
GENTOO_MIRRORS="ftp://ftp.gwdg.de/pub/linux/gentoo ftp://ftp.fi.muni.cz/pub/linux/gentoo"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en de_DE"
MAKEOPTS="-j16 -l18"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BZIP2_COMMAND="pbzip2"
PORTAGE_COMPRESS="zstd"
PORTAGE_COMPRESS_FLAGS="-6"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl alsa big-endian bluetooth brotli bzip2 cairo caja cdda cli colord crypt cryptsetup css cups dav1d dbus djvu dri dvd elogind enca exif filecaps flac fortran gtk gtk3 gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify lm-sensors mmap mng mp3 mtp ncurses networkmanager nls nptl nss ogg opengl openmp opus pam pcre pdf png policykit ppc pulseaudio qt5 raw readline seccomp smp spell split-usr ssl svg system-icu system-sqlite threads tiff truetype udev udisks unicode upower vorbis vpx webp widgets xattr xml xmp xxhash zlib zstd" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_PPC="altivec" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="ieee1275" INPUT_DEVICES="libinput" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU" LUA_SINGLE_TARGET="lua5-3" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" SANE_BACKENDS="genesys" USERLAND="GNU" VIDEO_CARDS="fbdev r300 radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

@stefson
Copy link
Owner Author

stefson commented Apr 6, 2022

given by the information you gave me, this should be sufficent to fix your problem:

--- a/src/bootstrap/builder.rs	2022-03-14 12:57:04.942958375 +0100
+++ b/src/bootstrap/builder.rs	2022-04-01 17:42:59.631219179 +0200
@@ -1212,7 +1212,7 @@
         // efficient initial-exec TLS model. This doesn't work with `dlopen`,
         // so we can't use it by default in general, but we can use it for tools
         // and our own internal libraries.
-        if !mode.must_support_dlopen() {
+        if !mode.must_support_dlopen() && !target.triple.starts_with("powerpc-") {
             rustflags.arg("-Ztls-model=initial-exec");
         }

which is the original patch: rust-lang/rust@283619c

the patch used right now merely extends the target.triple to powerpcle, but your system should not take notice of that. I could be wrong though, don't have any hardware to test.

@ernsteiswuerfel
Copy link

ernsteiswuerfel commented Apr 6, 2022

True. I successfully built 1.56.1 on ppc with the ppc32 patch disabled. I think the versions before still need the (original) patch.

The powerpcle target triple is Void Linux only AFAIK and that's where I got the patch from. They are about to create a ppc32 LE version of their distro. Don't know what's the working state of it however. ppc64 LE is rather common I guess. But ppc64 LE does not seem to need this patch? Don't have any PPC box on LE so I can't tell.

librsvg-2.54.0 builds on ppc32 too, so all good. 😄

@stefson
Copy link
Owner Author

stefson commented Apr 10, 2022

@ernsteiswuerfel I pushed 1.57.0 to the overlay, this is enough to build you nice firefox-99.0 and firefox-100.0 beta if you feel like testing them.

@stefson
Copy link
Owner Author

stefson commented Apr 12, 2022

1.58.1 at work:

firefox-98 0 2-musl

@stefson
Copy link
Owner Author

stefson commented Apr 12, 2022

hint: webrtc is horribly broken with the last update in firefox-94.0 on any arch except amd64, arm64 and x86 I believe. Simply pass additional --disable-webrtc

@ernsteiswuerfel
Copy link

Meanwhile I upgraded toolchain to musl-1.2.3 and binutils-2.38-r1 (+ gcc-11.2.1_p20220115 as before) on ppc64. And I am on your rust-1.58.1 now. rust-1.57 did not build with binutils-2.38-r1 (see logfile), I needed to use binutils-2.37_p1-r2.
rust-1.57.0:20220414-101217.log.gz

Did not build any of the new Firefox versions yet, only ESR.

@ernsteiswuerfel
Copy link

I was a bit occupied by other stuff but finally I opened an issue: crossbeam-rs/crossbeam#924

@ernsteiswuerfel
Copy link

Crossbeam should be fixed upstream now!

@stefson
Copy link
Owner Author

stefson commented Nov 17, 2022

oh indeed, that patch seems pretty good.

The problem with testing this is, you need get the fix into librsvg. Their devs will only update the crate to a fixed state if there is at least a point release available.

So maybe you can ask the crossbeam devs to cut a point release with the fixes included? If they agree and the update is available, you can then go to the librsvg devs and ask for the crossbeam crates to be updated, with the fix included.

And finally it will be fixed when there is a new point release of librsvg itself, with the updated crate vendored.

@ernsteiswuerfel
Copy link

I'd rather not annoy devs if it's not totally urgent. 😉 Last releases have been in Juni, July, September so I guess the next point release probably is not too far away.

But as soon as a new release is availiable I'll point the librsvg devs to it and ask them the crates to be updated.

@stefson
Copy link
Owner Author

stefson commented Nov 20, 2022

I saw you posted a different ppc64 bug on the librsvg gitlab bugtracker?

@ernsteiswuerfel
Copy link

Ah yes, this was my librsvg-2.55.1 build on ppc64-musl. At the time I filed this one I was not sure this being the same bug as on ppc32 as the error message looked differently.

Now closed as dupe of your crossbeam bug. Thanks for your efforts!

@stefson
Copy link
Owner Author

stefson commented Nov 20, 2022

I'm not entirely sure about that, since its a different crate (system-deps) which fails with ppc64 for you, but we shall see.

The patch doesn't backport to the stable branch I'm afraid.

@stefson
Copy link
Owner Author

stefson commented Nov 20, 2022

you can try to reproduce the ppc64 error with current librsvg by doing this:

git clone https://gitlab.gnome.org/GNOME/librsvg.git && cd librsvg
./autogen.sh --disable-debug --disable-introspection
make -jN

if you did reproduce, try again with the patch applied on top of your local git checkout

@ernsteiswuerfel
Copy link

git clone https://gitlab.gnome.org/GNOME/librsvg.git && cd librsvg ./autogen.sh --disable-debug --disable-introspection make -jN
It tells me I need rust-1.63.0. 😉

@stefson
Copy link
Owner Author

stefson commented Nov 24, 2022

I pushed 1.62.1 for you, 1.63.0 will follow shortly

the crossbeam crate version did change, please expect ppc32 build to fail and report back with the log if it does.

@ernsteiswuerfel
Copy link

Thanks! On ppc64 I need to go up from rust-1.59.0::smaeul to your 1.60.0 etc. first. Doing that right now.

@ernsteiswuerfel
Copy link

On ppc64 your rust built fine up to 1.63.0, thanks!

But what patch to apply on librsvg? Looks like the updated crates are already used, but still the build fails:

   Compiling autocfg v1.1.0
   Compiling serde v1.0.147
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling heck v0.4.0
   Compiling syn v1.0.103
   Compiling smallvec v1.10.0
   Compiling pkg-config v0.3.26
   Compiling version-compare v0.1.1
   Compiling libc v0.2.137
   Compiling cfg-if v1.0.0
   Compiling getrandom v0.1.16
   Compiling ppv-lite86 v0.2.17
   Compiling version_check v0.9.4
   Compiling siphasher v0.3.10
   Compiling thiserror v1.0.37
   Compiling once_cell v1.16.0
   Compiling futures-core v0.3.25
   Compiling memchr v2.5.0
   Compiling futures-task v0.3.25
   Compiling anyhow v1.0.66
   Compiling scopeguard v1.1.0
   Compiling bitflags v1.3.2
   Compiling futures-util v0.3.25
   Compiling pin-utils v0.1.0
   Compiling proc-macro-hack v0.5.19
   Compiling pin-project-lite v0.2.9
   Compiling futures-channel v0.3.25
   Compiling crossbeam-utils v0.8.13
   Compiling parking_lot_core v0.9.4
   Compiling encoding_index_tests v0.1.4
   Compiling gio v0.16.3
   Compiling log v0.4.17
   Compiling bytemuck v1.12.3
   Compiling new_debug_unreachable v1.0.4
   Compiling mac v0.1.1
   Compiling precomputed-hash v0.1.1
   Compiling futures-io v0.3.25
   Compiling tinyvec_macros v0.1.0
   Compiling utf-8 v0.7.6
   Compiling rayon-core v1.10.1
   Compiling dtoa v0.4.8
   Compiling os_str_bytes v6.4.1
   Compiling matches v0.1.9
   Compiling typenum v1.15.0
   Compiling regex-syntax v0.6.28
   Compiling nodrop v0.1.14
   Compiling rawpointer v0.2.1
   Compiling stable_deref_trait v1.2.0
   Compiling byteorder v1.4.3
   Compiling termcolor v1.1.3
   Compiling unicode-bidi v0.3.8
   Compiling either v1.8.0
   Compiling convert_case v0.4.0
   Compiling percent-encoding v2.2.0
   Compiling paste v1.0.9
   Compiling strsim v0.10.0
   Compiling itoa v0.4.8
   Compiling lazy_static v1.4.0
   Compiling iana-time-zone v0.1.53
   Compiling language-tags v0.3.2
   Compiling rctree v0.4.0
   Compiling cast v0.3.0
   Compiling encoding-index-tradchinese v1.20141219.5
   Compiling encoding-index-simpchinese v1.20141219.5
   Compiling encoding-index-japanese v1.20141219.5
   Compiling encoding-index-singlebyte v1.20141219.5
   Compiling encoding-index-korean v1.20141219.5
   Compiling phf_shared v0.8.0
   Compiling phf_shared v0.10.0
   Compiling futf v0.1.5
   Compiling cfg-expr v0.11.0
   Compiling tinyvec v1.6.0
   Compiling data-url v0.1.1
   Compiling safe_arch v0.6.0
   Compiling rgb v0.8.34
   Compiling servo_arc v0.1.1
   Compiling matrixmultiply v0.3.2
   Compiling dtoa-short v0.3.3
   Compiling form_urlencoded v1.1.0
   Compiling clap_lex v0.3.0
   Compiling itertools v0.10.5
   Compiling tendril v0.4.3
   Compiling wide v0.7.5
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling fxhash v0.2.1
   Compiling slab v0.4.7
   Compiling num-traits v0.2.15
   Compiling lock_api v0.4.9
   Compiling memoffset v0.7.1
   Compiling crossbeam-epoch v0.9.12
   Compiling num-integer v0.1.45
   Compiling num-rational v0.4.1
   Compiling encoding v0.2.33
   Compiling aho-corasick v0.7.19
   Compiling crossbeam-channel v0.5.6
   Compiling crossbeam-deque v0.8.2
   Compiling unicode-normalization v0.1.22
   Compiling atty v0.2.14
   Compiling time v0.1.44
   Compiling num_cpus v1.14.0
   Compiling getrandom v0.2.8
   Compiling parking_lot v0.12.1
   Compiling rand_core v0.5.1
   Compiling rand_core v0.6.4
   Compiling rand_pcg v0.2.1
   Compiling rand_chacha v0.2.2
   Compiling rand_chacha v0.3.1
   Compiling rand v0.7.3
   Compiling approx v0.5.1
   Compiling num-complex v0.4.2
   Compiling float-cmp v0.9.0
   Compiling rand v0.8.5
   Compiling idna v0.3.0
   Compiling rayon v1.6.0
   Compiling chrono v0.4.23
   Compiling regex v1.7.0
   Compiling url v2.3.1
   Compiling phf_generator v0.8.0
   Compiling phf_generator v0.10.0
   Compiling phf_codegen v0.8.0
   Compiling simba v0.7.3
   Compiling string_cache_codegen v0.5.2
   Compiling selectors v0.23.0
   Compiling locale_config v0.3.0
   Compiling markup5ever v0.10.1
   Compiling toml v0.5.9
   Compiling string_cache v0.8.4
   Compiling system-deps v6.0.3
   Compiling glib-sys v0.16.3
   Compiling gobject-sys v0.16.3
   Compiling gio-sys v0.16.3
   Compiling pango-sys v0.16.3
   Compiling cairo-sys-rs v0.16.3
   Compiling gdk-pixbuf-sys v0.16.3
   Compiling pangocairo-sys v0.16.3
   Compiling librsvg v2.55.0 (/root/build/librsvg)
   Compiling thiserror-impl v1.0.37
   Compiling futures-macro v0.3.25
   Compiling phf_macros v0.8.0
   Compiling cssparser v0.28.1
   Compiling cssparser-macros v0.6.0
   Compiling clap_derive v4.0.21
   Compiling derive_more v0.99.17
   Compiling nalgebra-macros v0.1.0
error: failed to run custom build command for `librsvg v2.55.0 (/root/build/librsvg)`

Caused by:
  process didn't exit successfully: `/root/build/librsvg/target/release/build/librsvg-34e8182b1458d561/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=CAIRO_PDF_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=CAIRO_PS_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=CAIRO_SVG_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64-gentoo-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_powerpc64_gentoo_linux_musl
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'Invalid TARGET: powerpc64-gentoo-linux-musl', /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/system-deps-6.0.3/src/lib.rs:807:32
  stack backtrace:
     0:        0x10e06920c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h481e31de262b2f3f
     1:        0x10e0a2618 - core::fmt::write::h7ebfdfdf40b20b1d
     2:        0x10e0640b8 - std::io::Write::write_fmt::h735ecbd907f6146e
     3:        0x10e06b6f0 - std::panicking::default_hook::{{closure}}::hb36295d1a5273e6b
     4:        0x10e06b15c - std::panicking::default_hook::hf6443a6da9c080b4
     5:        0x10e06bfd0 - std::panicking::rust_panic_with_hook::h0e917160b6e9a760
     6:        0x10e06bce0 - std::panicking::begin_panic_handler::{{closure}}::h22aa04f197e5f777
     7:        0x10e069888 - std::sys_common::backtrace::__rust_end_short_backtrace::hc2e6b50e84b4ee07
     8:        0x10e06b88c - rust_begin_unwind
     9:        0x10dd84ea4 - core::panicking::panic_fmt::hf4a36b1b8ffae1b7
    10:        0x10dda5b18 - system_deps::Config::check_cfg::{{closure}}::h08e5f64dca67244b
    11:        0x10dd8c0c0 - core::option::Option<T>::unwrap_or_else::h1400fffde8c2f07b
    12:        0x10dda5a0c - system_deps::Config::check_cfg::h658426a9da33435f
    13:        0x10dda34fc - system_deps::Config::probe_pkg_config::ha79dd5e7f4f0a928
    14:        0x10dda2e50 - system_deps::Config::probe_full::h9d68fd265baa4553
    15:        0x10dda2970 - system_deps::Config::probe::h253f5a1155cc4f7b
    16:        0x10dd86070 - build_script_build::main::hc82479653160ab6c
    17:        0x10dd88204 - core::ops::function::FnOnce::call_once::hfd2809c7d3bc8f08
    18:        0x10dd88f58 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc1969e883094101b
    19:        0x10dd88ba8 - std::rt::lang_start::{{closure}}::h4291dbf18634e25c
    20:        0x10e05dc60 - std::rt::lang_start_internal::h4c105ed65d06e417
    21:        0x10dd88b64 - std::rt::lang_start::h7c9716fc44d30f6b
    22:        0x10dd87df8 - main
    23:     0x3fff98dfeee0 - <unknown>
warning: build failed, waiting for other jobs to finish...
make[2]: *** [Makefile:1554: librsvg_c_api.la] Error 101

@stefson
Copy link
Owner Author

stefson commented Nov 25, 2022

this is reproducer of https://gitlab.gnome.org/GNOME/librsvg/-/issues/916

which means only the crossbeam ppc32 bug is fixed, not the other in system-deps.

@ernsteiswuerfel
Copy link

this is reproducer of https://gitlab.gnome.org/GNOME/librsvg/-/issues/916

which means only the crossbeam ppc32 bug is fixed, not the other in system-deps.

So this is a seperate issue after all? Suppose we may run into this on ppc32 despite of the ppc32-crossbeam bug fixed?

@ernsteiswuerfel
Copy link

the crossbeam crate version did change, please expect ppc32 build to fail and report back with the log if it does.

Here's the ppc32 rust-1.62.1 log.
rust-1.62.1:20221125-131710.log

@stefson
Copy link
Owner Author

stefson commented Nov 25, 2022

Yes, these are two seperate bugs. You should reopen https://gitlab.gnome.org/GNOME/librsvg/-/issues/916

I pushed the crossbeam patch for rust-1.62.1, and added the checksums few minutes later. Please report back if this is working four you on ppc32

@ernsteiswuerfel
Copy link

Reopenend the ppc64 librsvg issue.

rust-1.62.1 builds and works fine now on ppc32. At building ust-1.63.0 I got probably the same issue as before.
rust-1.63.0:20221125-161011.log

@ernsteiswuerfel
Copy link

Upstream librsvg issue #916 has been closed with following comment:

I have no idea of how build environments look for a platform like that. For 'exotic platforms', you are on your own 😃 I hope you find some ideas in these:

The panic you are seeing comes from this check in system-deps where it checks that get_builtin_target_by_triple() was able to find a suitable target. In turn, get_builtin_target_by_triple() is implemented here, which works by just comparing the triple strings against the ALL_BUILTINS list. You'll notice that there's no triple there with gentoo in it.

crossbeam-rs/crossbeam#922 - replace the gentoo vendor in target triples with unknown.

I have no idea if just replacing gentoo with unknown will work, although there is an entry for powerpc64-unknown-linux-musl, which may be what you want.

What's easier for you to try? Patch something in system-deps or cfg-expr so they modify the triple string with unknown? Use a cross-compilation scheme to use an explicit powerpc64-unknown-linux-musl instead of gentoo's default?
I'll close this bug because it is not really librsvg's fault.

So how to proceed from here on?

@stefson
Copy link
Owner Author

stefson commented Dec 22, 2022

I've pushed rust-1.64.0 ebuild for you, are you ready to upgrade to llvm-15 toolchain? I've tested rust-1.65.0 extensivly, and may push both 1.65.0 and 1.66.0 soon if you want to.

@ernsteiswuerfel
Copy link

I already upgraded to llvm-15 toolchain on ppc32/ppc64 as some ppc32 llvm bugs have been sorted out upstream in 15.0.6 (or was it 15.0.5?). Working fine so far.

I'll could give 1.65.0 and 1.66.0 a try next weekend or so.

@stefson
Copy link
Owner Author

stefson commented Dec 23, 2022

Alright, I will push them both today or tomorrow. If you run into any build error just ping me and I see what I can do.

I'm not sure what to do about the librsvg problem, find it rather appalling they closed the upstream issue. At least they should leave it open and label it with patches welcome for others to pick it up.

@ernsteiswuerfel
Copy link

Tried building 1.64.0 on ppc64 but got some problems.

First I needed to alter EAPI=7 in the built to EAPI=8 or it was not able to start building at all (build blocked to corruption). Second 0016-fix-ppc32-crossbeam-utils.patch did not apply so I altered it to use the checksum of the relevant file in the rust sources. In the late building process it failed after all due to

[...]
    Finished release [optimized] target(s) in 9m 06s
      c Sysroot { compiler: Compiler { stage: 2, host: powerpc64-gentoo-linux-musl } }
Copy "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/powerpc64-gentoo-linux-musl/stage1-tools/powerpc64-gentoo-linux-musl/release/rustdoc_tool_binary" to "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/powerpc64-gentoo-linux-musl/stage2/bin/rustdoc"
    < Rustdoc { compiler: Compiler { stage: 2, host: powerpc64-gentoo-linux-musl } }
Install "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/powerpc64-gentoo-linux-musl/stage2/bin/rustdoc" to "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/tmp/tarball/rustc/powerpc64-gentoo-linux-musl/image/bin/rustdoc"
Copy "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/powerpc64-gentoo-linux-musl/stage2/bin/rustdoc" to "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/tmp/tarball/rustc/powerpc64-gentoo-linux-musl/image/bin/rustdoc"
    c Assemble { target_compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
    > RustAnalyzerProcMacroSrv { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl }, target: powerpc64-gentoo-linux-musl }
      > ToolBuild { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl }, target: powerpc64-gentoo-linux-musl, tool: "rust-analyzer-proc-macro-srv", path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli", mode: ToolStd, is_optional_tool: false, source_type: InTree, extra_features: ["proc-macro-srv/sysroot-abi"] }
        c Std { target: powerpc64-gentoo-linux-musl, compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl }, crates: [] }
        c Libdir { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl }, target: powerpc64-gentoo-linux-musl }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
        c Sysroot { compiler: Compiler { stage: 1, host: powerpc64-gentoo-linux-musl } }
Building stage1 tool rust-analyzer-proc-macro-srv (powerpc64-gentoo-linux-musl)
running: "/usr/lib/rust/1.63.0/bin/cargo" "build" "--target" "powerpc64-gentoo-linux-musl" "-Zcheck-cfg=names,values,output,features" "-Zbinary-dep-depinfo" "-j" "16" "-v" "-v" "--release" "--locked" "--frozen" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml" "--features" "proc-macro-srv/sysroot-abi" "--message-format" "json-render-diagnostics"
error: checksum for `crossbeam-utils v0.8.10` changed between lock files

this could be indicative of a few possible errors:

    * the lock file is corrupt
    * a replacement source in use (e.g., a mirror) returned a different checksum
    * the source itself may be corrupt in one way or another

unable to verify that `crossbeam-utils v0.8.10` is the same as when the lockfile was generated

command did not execute successfully: "/usr/lib/rust/1.63.0/bin/cargo" "build" "--target" "powerpc64-gentoo-linux-musl" "-Zcheck-cfg=names,values,output,features" "-Zbinary-dep-depinfo" "-j" "16" "-v" "-v" "--release" "--locked" "--frozen" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/src/tools/rust-analyzer/crates/proc-macro-srv-cli/Cargo.toml" "--features" "proc-macro-srv/sysroot-abi" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/./x.py", line 48, in <module>
    bootstrap.main()
  File "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/src/bootstrap/bootstrap.py", line 928, in main
    bootstrap(help_triggered)
  File "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/src/bootstrap/bootstrap.py", line 914, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/src/bootstrap/bootstrap.py", line 166, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/bootstrap install -vv --config=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/config.toml -j16
 * ERROR: dev-lang/rust-1.64.0::localrepo failed (install phase):

0016-fix-ppc32-crossbeam-utils.patch.tar.gz
rust-1.64.0:20230101-175830.log.tar.gz

@stefson
Copy link
Owner Author

stefson commented Jan 1, 2023

Patch is refreshed now, I forgot to fix the checksums. Does it now work for you?

@ernsteiswuerfel
Copy link

Yes, 1.64.0 successfully built on ppc64. Thanks!

Only thing I needed to do now is to copy the ebuild do my localrepo and set EAPI=8 (or it won't start bullding). Also when starting to emerge I am getting lots of these:

 # emerge -p1v dev-lang/rust virtual/rust

These are the packages that would be merged, in order:

Calculating dependencies | * ERROR: dev-lang/rust-9999::gentoo-extras failed (depend phase):
 *   rust-toolchain: EAPI 7 not supported
 * 
 * Call stack:
 *               ebuild.sh, line 628:  Called source '/var/db/repos/gentoo-extras/dev-lang/rust/rust-9999.ebuild'
 *        rust-9999.ebuild, line   8:  Called inherit 'bash-completion-r1' 'check-reqs' 'estack' 'flag-o-matic' 'llvm' 'multiprocessing' 'multilib-build' 'python-any-r1' 'rust-toolchain' 'toolchain-funcs' 'git-r3'      \ *               ebuild.sh, line 308:  Called __qa_source '/var/db/repos/gentoo/eclass/rust-toolchain.eclass'
 *               ebuild.sh, line 123:  Called source '/var/db/repos/gentoo/eclass/rust-toolchain.eclass'
 *   rust-toolchain.eclass, line  16:  Called die
 * The specific snippet of code:
 *   	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/rust-9999::gentoo-extras'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/rust-9999::gentoo-extras'`.
 * Working directory: '/usr/lib/python3.11/site-packages'                                                    | * S: '/var/tmp/portage/dev-lang/rust-9999/work/rust-9999'                                                   \ * ERROR: dev-lang/rust-999::gentoo-extras failed (depend phase):
 *   rust-toolchain: EAPI 7 not supported
[...]

But it built fine anyhow. 1.65.0 next on ppc64...

@stefson
Copy link
Owner Author

stefson commented Jan 2, 2023

you can simply revert this commit for now: gentoo/gentoo@a8a9021

I may have to upgrade everything to eapi8, but I can't test the older ebuilds anymore due to the system-bootstrap process. Ideas, thoughts?

@ernsteiswuerfel
Copy link

I think there probably is no (easy) solution for that problem. Gentoo ditches old rust ebuilds after some time when new stable versions are available and old versions are no longer required for in-tree-ebuilds. To maintain the old ones incl. eclasses to keep them buildable just does not seem feasibly. Only hope would be that smaeul releases some newer rust version buildable from upstream static-rust-binaries again to use this as a starting point (again) until upstream gets this dynamic linking stuff sorted out needed at least for some distros. 😮‍💨

@ernsteiswuerfel
Copy link

BTW bulding 1.64.0 and 1.65.0 on ppc64 went fine. On ppc32 I ran into troubles on ppc32:

error[E0432]: unresolved imports `core::sync::atomic::AtomicI64`, `core::sync::atomic::AtomicU64`
  --> /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/vendor/crossbeam-utils-0.8.8/src/lib.rs:79:49
   |
79 |             pub(crate) use core::sync::atomic::{AtomicI64, AtomicU64};
   |                                                 ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
   |                                                 |
   |                                                 no `AtomicI64` in `sync::atomic`

rust-1.64.0:20230105-114931.log

@stefson
Copy link
Owner Author

stefson commented Jan 6, 2023

the ppc32 error is the same as before, its just that rust does sometimes vendors two versions of the same crate. I have yet failed to understand why this is, and why and when the build uses the versioned and when it uses the unversioned version.

The static libc patches had the same problem, until a fix was merged.

@stefson
Copy link
Owner Author

stefson commented Jan 6, 2023

please try again with ppc32

@ernsteiswuerfel
Copy link

1.64.0 successfully built on ppc32, thanks! Now the same unresolved imports 'core::sync::atomic::AtomicI64', 'core::sync::atomic::AtomicU64' with 1.65.0. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants