Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 748849 - www-client/firefox: the `x86_64-gentoo-linux-musl` target may not be installed
Summary: www-client/firefox: the `x86_64-gentoo-linux-musl` target may not be installed
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-10-14 07:49 UTC by 12101111
Modified: 2022-09-24 17:39 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
rust-target-respect-override.patch (file_748849.txt,1.73 KB, patch)
2022-09-22 00:57 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description 12101111 2020-10-14 07:49:45 UTC
dev-lang/rust-1.47.0 add gentoo vendor target but don't build std for those target.
The default target in rust is still x86_64-unknown-linux-musl.

$ rustc --print target-libdir
/usr/lib/rust/1.47.0/lib/rustlib/x86_64-unknown-linux-musl/lib

And x86_64-gentoo-linux-musl is in target list of rust:

rustc --print target-list | grep musl
aarch64-gentoo-linux-musl
aarch64-unknown-linux-musl
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv5te-unknown-linux-musleabi
armv7-gentoo-linux-musleabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
hexagon-unknown-linux-musl
i586-unknown-linux-musl
i686-gentoo-linux-musl
i686-unknown-linux-musl
mips-unknown-linux-musl
mips64-unknown-linux-muslabi64
mips64el-unknown-linux-muslabi64
mipsel-unknown-linux-musl
powerpc-gentoo-linux-musl
powerpc-unknown-linux-musl
powerpc64-gentoo-linux-musl
powerpc64-unknown-linux-musl
powerpc64le-gentoo-linux-musl
powerpc64le-unknown-linux-musl
thumbv7neon-unknown-linux-musleabihf
x86_64-gentoo-linux-musl
x86_64-unknown-linux-musl

In firefox's rust.configure, x86_64-gentoo-linux-musl is chosen as the build target (base on CHOST), and failed because there is no std for this target.

We should disable those gentoo vendor target until https://bugs.gentoo.org/747760 is useable or patch rust.configure to choose x86_64-unknown-linux-musl

Reproducible: Always

Actual Results:  
 0:14.23 checking for rustc... /usr/bin/rustc
 0:14.23 checking for cargo... /usr/bin/cargo
 0:14.32 checking rustc version... 1.47.0-nightly
 0:14.32 checking cargo version... 1.47.0
 0:14.46 checking for rust target triplet...
 0:14.46 DEBUG: Creating `/tmp/portage/www-client/firefox-81.0.2/temp/conftest6hcd0hy_.rs` with content:
 0:14.46 DEBUG: | pub extern fn hello() { println!("Hello world"); }
 0:14.46 DEBUG: Executing: `/usr/bin/rustc --crate-type staticlib --target=x86_64-gentoo-linux-musl -o /tmp/portage/www-client/firefox-81.0.2/temp/conftest99l1dfs8.rlib /tmp/portage/www-client/firefox-81.0.2/temp/conftest6hcd0hy_.rs`
 0:14.46 DEBUG: The command returned non-zero exit status 1.
 0:14.46 DEBUG: Its error output was:
 0:14.46 DEBUG: | error[E0463]: can't find crate for `std`
 0:14.46 DEBUG: |   |
 0:14.46 DEBUG: |   = note: the `x86_64-gentoo-linux-musl` target may not be installed
 0:14.46 DEBUG: |
 0:14.46 DEBUG: | error: aborting due to previous error
 0:14.46 DEBUG: |
 0:14.46 DEBUG: | For more information about this error, try `rustc --explain E0463`.
 0:14.46 ERROR: Cannot compile for x86_64-gentoo-linux-musl with /usr/bin/rustc
 0:14.46 The target may be unsupported, or you may not have
 0:14.46 a rust std library for that target installed. Try:
 0:14.46
 0:14.46   rustup target add x86_64-gentoo-linux-musl
 0:14.46
 0:14.51 *** Fix above errors and then restart with\
 0:14.51                "./mach build"
 0:14.51 gmake: *** [client.mk:115: configure] Error 1
Comment 1 Georgy Yakovlev archtester gentoo-dev 2020-10-15 10:37:34 UTC
yes, it's work in progress and not a mistake.
I've added them so rust knows the target definitions.

bootstrap from -unknown- to -gentoo- still does not work, even with json target specification and I will tackle it as I have more time, probably by providing bootstrap tarballs.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-10-15 10:39:24 UTC
and since firefox does not work with ::gentoo rust on musl, just use ::smaeul for now, as usual. it has real gentoo target with std.
so nothing really changed. but work in progress on that.
Comment 3 acidtonic 2021-11-05 19:02:25 UTC
I'm also hitting this still on a new build with musl. Rustup is not found after rust is installed so I'm not sure how to proceed.

I also do not need firefox but a basic world update after getting the kernel and grub built is pulling it in.Yo
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2021-12-06 15:42:52 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 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 00:57:19 UTC
Created attachment 813445 [details, diff]
rust-target-respect-override.patch

See attached rust-target-respect-override.patch. Thanks to gyakovlev, worked out a proper solution for this.

It allows a successful build with dev-lang/rust + www-client/firefox-105.0. Tested on glibc as well with no interference.

It'll need a change in the ebuild too:
```
--- a/www-client/firefox/firefox-105.0.ebuild
+++ b/www-client/firefox/firefox-105.0.ebuild
@@ -38,7 +38,7 @@
 MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"

 inherit autotools check-reqs desktop flag-o-matic gnome2-utils linux-info \
-       llvm multiprocessing pax-utils python-any-r1 toolchain-funcs \
+       llvm multiprocessing pax-utils python-any-r1 rust-toolchain toolchain-funcs \
        virtualx xdg

 MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}"
@@ -580,6 +580,8 @@
        # Make cargo respect MAKEOPTS
        export CARGO_BUILD_JOBS="$(makeopts_jobs)"

+       export RUST_TARGET=$(rust_abi)
+
        # Make LTO respect MAKEOPTS
        sed -i \
                -e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
```

If you want, feel free to only export it on musl or something.
Comment 6 Joonas Niilola gentoo-dev 2022-09-22 10:44:40 UTC
Inheriting rust-toolchain enables multilib for Firefox breaking it (on a multilibbed system at least).

I've added the patch in https://dev.gentoo.org/~juippis/mozilla/patchsets/firefox-105-patches-02j.tar.xz and tested with your changes and ABI_X86="-32" and it works. If you can figure out a way to disable multilib, go ahead and commit your changes while also bumping the patch set. 


--- /tmp/firefox-105.0.ebuild	2022-09-22 10:43:32.554676715 -0000
+++ ./firefox-105.0.ebuild	2022-09-22 09:52:29.218883003 -0000
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-FIREFOX_PATCHSET="firefox-105-patches-01j.tar.xz"
+FIREFOX_PATCHSET="firefox-105-patches-02j.tar.xz"
 
 LLVM_MAX_SLOT=14
 
@@ -38,7 +38,7 @@
 MOZ_P_DISTFILES="${MOZ_PN}-${MOZ_PV_DISTFILES}"
 
 inherit autotools check-reqs desktop flag-o-matic gnome2-utils linux-info \
-	llvm multiprocessing pax-utils python-any-r1 toolchain-funcs \
+	llvm multiprocessing pax-utils python-any-r1 rust-toolchain toolchain-funcs \
 	virtualx xdg
 
 MOZ_SRC_BASE_URI="https://archive.mozilla.org/pub/${MOZ_PN}/releases/${MOZ_PV}"
@@ -580,6 +580,9 @@
 	# Make cargo respect MAKEOPTS
 	export CARGO_BUILD_JOBS="$(makeopts_jobs)"
 
+	# Respect RUST_TARGET, #748849
+	export RUST_TARGET=$(rust_abi)
+
 	# Make LTO respect MAKEOPTS
 	sed -i \
 		-e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
Comment 7 Joonas Niilola gentoo-dev 2022-09-22 12:33:43 UTC
I guess using MULTILIB_COMPAT is the *cleanest* way (that I can think of at least) but it still leaves that ABI_X86="(64)" to emerge output...
Comment 8 Georgy Yakovlev archtester gentoo-dev 2022-09-22 21:51:36 UTC
let's maybe hold off the patch, COMPAT thing seems a bit off tbh.

I wanted to redo that eclass for a LONG time, maybe I'll just move it to separate small rust_targets.eclass without multilib in it.

alternative solution is to (pseudobash)
basically if elibc_musl and chost == *-gentoo-*; then RUST_TARGET=${CHOST/-gentoo-/-unknown-}; fi


and third and hardest solution is to merge a variant of 
https://github.com/gentoo/gentoo/pull/20727

which gets rid rust of multilib abi flags and implements gcc-like USE=multilib
Comment 9 Georgy Yakovlev archtester gentoo-dev 2022-09-22 21:52:07 UTC
and maybe I can make rust install -gentoo- target too.
just need time to poke it.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-22 22:41:23 UTC
(In reply to Georgy Yakovlev from comment #8)
> let's maybe hold off the patch, COMPAT thing seems a bit off tbh.
> 
> I wanted to redo that eclass for a LONG time, maybe I'll just move it to
> separate small rust_targets.eclass without multilib in it.
> 

This is my preference for now.