Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 779178

Summary: www-client/firefox: musl patches break glibc build on ARM (note: the `armv7-gentoo-linux-musleabihf` target may not be installed) with =dev-lang/rust-1.47.0-r2
Product: Gentoo Linux Reporter: David Flogeras <dflogeras2>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED NEEDINFO    
Severity: normal CC: herrtimson, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=768906
https://bugs.gentoo.org/show_bug.cgi?id=836226
https://bugs.gentoo.org/show_bug.cgi?id=748849
Whiteboard:
Package list:
Runtime testing required: ---

Description David Flogeras 2021-03-29 22:57:49 UTC
I've successfully built rust-1.47.0-r2 on regular armv7a-unknown-linux-gnueabihf (glibc).  However, when attempting to build firefox with this version of rust, I get the following error:


 0:43.68 checking for rust target triplet...
 0:43.68 DEBUG: Creating `/var/tmp/portage/www-client/firefox-78.9.0/temp/confte
stthjvravq.rs` with content:
 0:43.68 DEBUG: | pub extern fn hello() { println!("Hello world"); }
 0:43.68 DEBUG: Executing: `/usr/bin/rustc --crate-type staticlib --target=armv7
-gentoo-linux-musleabihf -o /var/tmp/portage/www-client/firefox-78.9.0/temp/conf
testy5xmt0ay.rlib /var/tmp/portage/www-client/firefox-78.9.0/temp/conftestthjvra
vq.rs`
 0:43.68 DEBUG: The command returned non-zero exit status 1.
 0:43.68 DEBUG: Its error output was:
 0:43.68 DEBUG: | error[E0463]: can't find crate for `std`
 0:43.68 DEBUG: |   |
 0:43.68 DEBUG: |   = note: the `armv7-gentoo-linux-musleabihf` target may not b
e installed
 0:43.68 DEBUG: |
 0:43.68 DEBUG: | error: aborting due to previous error
 0:43.68 DEBUG: |
 0:43.69 DEBUG: | For more information about this error, try `rustc --explain E0
463`.
 0:43.69 ERROR: Cannot compile for armv7a-unknown-linux-gnueabihf with /usr/bin/
rustc



Going back to rust-1.46.0 allows me to build firefox.

emerge --info to follow

Reproducible: Always
Comment 1 David Flogeras 2021-03-29 22:58:12 UTC
emerge --info
Portage 3.0.17 (python 3.8.8-final-0, default/linux/arm/17.0/armv7a/desktop, gcc-10.2.0, glibc-2.31-r7, 5.4.97-gentoo armv7l)
=================================================================
System uname: Linux-5.4.97-gentoo-armv7l-ARMv7_Processor_rev_4_-v7l-with-glibc2.4
KiB Mem:    65797008 total,  53028588 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 29 Mar 2021 16:30:01 +0000
Head commit of repository gentoo: 7a46d24421c689e39582e0dda4bc7648e7719e6c
sh bash 5.0_p18
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
ccache version 4.2 [disabled]
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.8.8::gentoo
dev-util/ccache:          4.2::gentoo
dev-util/cmake:           3.18.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.35.1-r1::gentoo
sys-devel/gcc:            6.5.0-r3::gentoo, 7.5.0-r1::gentoo, 8.4.0-r1::gentoo, 9.3.0-r2::gentoo, 10.2.0-r5::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="@FREE"
CBUILD="armv7a-unknown-linux-gnueabihf"
CFLAGS="-pipe -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -O2"
CHOST="armv7a-unknown-linux-gnueabihf"
CONFIG_PROTECT="/etc /usr/share/config /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="-pipe -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -O2"
DISTDIR="/usr/portage/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="-O2 -pipe -march=armv7-a"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news nodoc noinfo parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv7-a"
GENTOO_MIRRORS="http://mirror.its.dal.ca/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j12"
PKGDIR="/usr/portage/packages"
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"
USE="X a52 aac acl alsa arm berkdb bluetooth branding bzip2 cairo cdda cdr cli crypt dbus dri dts dvdr elogind emboss encode exif flac gdbm gif gpm gtk gui iconv icu jpeg lcms libglvnd libnotify mad mng mp3 mp4 mpeg ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt5 readline sdl seccomp spell split-usr ssl startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ADA_TARGET="gnat_2018" 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_ARM="neon vfpv3 edsp thumb thumb2 v4 v5 v6 v7 vfp" ELIBC="glibc" 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" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" USERLAND="GNU" 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:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-30 17:49:46 UTC
I was sure I filed a bug for this. The musl patch for Firefox/SpiderMonkey is broken and for some reason will assume musl in general even on glibc. I hit this too.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-30 18:47:18 UTC
Unless there’s real interest in fixing this properly, are we able to just conditionally patch on musl for now?
Comment 4 tt_1 2021-03-30 20:19:53 UTC
yeah, me too. But which musl patch is broken though? I tried to remove them all in src_prepare, which didn't help much if I remember correctly. 

(I only tried with rust-bin)
Comment 5 David Flogeras 2021-03-31 10:30:58 UTC
I tried by removing the most likely (IMO) patch:

firefox-patches/0011-musl-Support-custom-vendor-strings.patch

To no avail.

I'll try rebuilding rust without the patch:
files/1.48.0-gentoo-musl-target-specs.patch

And then see if that changes the outcome, but this will take a bit since rust 1.48 locks up if I try a parallel build, and building -j1 takes a very long time in qemu-chroot.
Comment 6 David Flogeras 2021-04-04 15:43:57 UTC
Sorry, I mis-typed in my previous comment regarding rust-1.48, I meant 1.47.  Here's what I've tested

rebuilt rust-1.47 for arm glibc, but removing the following patch:

        "${FILESDIR}"/gentoo-musl-target-specs.patch

Then I rebuilt firefox-78.9.0 successfully without any modification.  Perhaps we would make the rust patch for musl apply only if elibc_musl is present?
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2021-12-06 15:43:42 UTC
Since normal rust is now working even for musl, we dropped our musl target patch with 91.4.0esr and 95.0 after consulting with musl patch.

Fixed rust should be available in ::gentoo shortly.
Comment 8 David Flogeras 2022-01-23 12:29:20 UTC
Rust is still broken in tree for me.  Just built 1.58.1 for glibc, and the musl patch is still making firefox think it is on musl when it configures.

Should I reopen this, or start a new bug?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-23 17:32:59 UTC
(In reply to David Flogeras from comment #8)
> Rust is still broken in tree for me.  Just built 1.58.1 for glibc, and the
> musl patch is still making firefox think it is on musl when it configures.
> 
> Should I reopen this, or start a new bug?

Let's reopen it. I don't think ::gentoo Rust works for ::musl right now.

We should still just be applying these patches *conditionally* like I've suggested before.
Comment 10 Joonas Niilola gentoo-dev 2022-01-27 12:46:31 UTC
Can someone give me a quick rundown here? From what I've read so far we need to do:

if use arm && ! use elibc_musl; then
  rm "${WORKDIR}"/firefox-patches/00xx-some-specific.patch || die
fi
eapply "${WORKDIR}/firefox-patches"

What patch exactly? What versions of firefox / spidermonkey are affected? What about Thunderbird?
Comment 11 David Flogeras 2022-01-28 12:21:15 UTC
My very limited view of it:

I _think_ this is actually a rust build problem (as the original bug was labelled, *cough* sam *cough*).

If I build rust as it is in tree, the _unconditional_ patch "1.49.0-gentoo-musl-target-specs.patch" is applied (even on glibc).  It builds just fine and merges.

However, when I try to configure firefox, it fails as the original report summary.  I do not recall if spidermonkey does the same but I would assume so (I think I always hit it rebuilding firefox because it changes more often).  I have no comment on thunderbird because I dont build it for arm.

If I rebuild rust _without_ the 1.49.0-gentoo-musl-target-specs.patch applied, then build firefox, all is well.

I think sam's proposed fix is to (in rust) only apply the musl patch, if elibc_musl is true.
Comment 12 tt_1 2022-01-28 16:46:03 UTC
(In reply to David Flogeras from comment #11)

> 
> I think sam's proposed fix is to (in rust) only apply the musl patch, if
> elibc_musl is true.

sadly, at the moment there is no use case for the rust patch in question on armv7a-unknown-linux-gnueabihf, as there is no upstream stage available to bootstrap rustc from. 

possible fix for glibc based arm users is to remove the patch, so no fancy if elibc_musl; then needed here.
Comment 13 Joonas Niilola gentoo-dev 2023-07-19 06:13:13 UTC
Since arm isn't currently keyworded I think I want a combined bug with all arm-related fixed to ever have it keyworded again.
Comment 14 tt_1 2023-07-21 20:59:32 UTC
How about a tracker bug as a meta bug, to reintroduce keywording for firefox on arm? Closing this bug is fine, as I need to recheck on the issues anyway and all information is outdated.
Comment 15 Joonas Niilola gentoo-dev 2023-07-22 05:13:42 UTC
(In reply to tt_1 from comment #14)
> How about a tracker bug as a meta bug, to reintroduce keywording for firefox
> on arm? Closing this bug is fine, as I need to recheck on the issues anyway
> and all information is outdated.

I would like that, thanks! I do have my concerns about the arm keyword but seeing you're active we can try. AFAIK upstream doesn't test on arm, but they test on arm64.