Cannot detect valid Rust target on Yocto buid system
Categories
(Firefox Build System :: General: Unsupported Platforms, enhancement, P5)
Tracking
(Not tracked)
People
(Reporter: ashie, Unassigned)
References
Details
Attachments
(4 files, 1 obsolete file)
I got the following error when I try to build mozilla-central on Yocto build system.
0:05.41 DEBUG: Executing: `/build/master/build/tmp/work/i586-poky-linux/firefox/68esr-r0/recipe-sysroot-native/usr/bin/rustc --crate-type staticlib --target=i686-unknown-linux-gnu -o /tmp/conftest5oS4YD.rlib /tmp/conftestD7xj2s.rs`
0:05.41 DEBUG: The command returned non-zero exit status 1.
0:05.41 DEBUG: Its error output was:
0:05.41 DEBUG: | error[E0463]: can't find crate for `std`
0:05.41 DEBUG: | |
0:05.41 DEBUG: | = note: the `i686-unknown-linux-gnu` target may not be installed
0:05.41 DEBUG: |
0:05.42 DEBUG: | error: aborting due to previous error
0:05.42 DEBUG: |
0:05.42 DEBUG: | For more information about this error, try `rustc --explain E0463`.
0:05.42 ERROR: Cannot compile for i586-poky-linux-gnu with /build/master/build/tmp/work/i586-poky-linux/firefox/68esr-r0/recipe-sysroot-native/usr/bin/rustc
The mozilla build system tries to guess Rust target but it may fail on certain platform such as Yocto.
Although Yocto can provide valid Rust target name, there is no chance to pass it to mozilla's build system.
It would be better that it has an option to do it.
Reporter | ||
Comment 1•6 years ago
|
||
Certain build systems such as Yocto know more suitable Rust target name, so it
would be better that there is a way to pass it to Mozilla's build system.
Comment 2•6 years ago
|
||
Please provide your mozconfig and a complete config.log
file. Given that you're compiling for i586-poky-linux-gnu
, I think we ought to be selecting the i586-unknown-linux-gnu
target...but I also think that we don't support compiling Firefox for systems without SSE2 anymore.
Reporter | ||
Comment 3•6 years ago
|
||
The above log is just for an example, our main target is x86_64, Arm and AArch64.
It fails to detect against such platforms as well.
I confirmed that I can build against them by the attached patch.
Comment 4•6 years ago
|
||
(In reply to Takuro Ashie [:ashie] from comment #3)
The above log is just for an example, our main target is x86_64, Arm and AArch64.
It fails to detect against such platforms as well.
I confirmed that I can build against them by the attached patch.
This looks more like a complete build configuration mechanism than a patch.
Please provide the information requested in comment 2. Thanks.
Reporter | ||
Comment 5•6 years ago
|
||
Reporter | ||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Reporter | ||
Comment 7•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 8•6 years ago
|
||
Sorry, the first config.log is for the patched version.
The later one is for the non-patched version.
Reporter | ||
Comment 9•6 years ago
|
||
FYI it seems that it can't find Rust stdlib on Yocto when performing test compile.
We apply the following patch for 60esr to avoid it:
Comment 10•6 years ago
|
||
Ah, the problem is that we canonicalize i586-poky-linux-gnu
to be "x86 cpu on linux", which selects the i686 runtime libraries. We'd have to somehow split things up so that i586 actually looks like a different CPU to the rust target selection process...but again, I don't think we support 32-bit x86 CPUs that don't support SSE2.
(In reply to Takuro Ashie [:ashie] from comment #9)
FYI it seems that it can't find Rust stdlib on Yocto when performing test compile.
We apply the following patch for 60esr to avoid it:
This doesn't seem like a proper fix: this fixes the configure test, but surely rustc
will be invoked later in the build process and need the exact same -L
flag, otherwise linking Rust libraries will fail?
Reporter | ||
Comment 11•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 12•6 years ago
|
||
I attached a config.log for the case of AArch64.
It also fails with original code and success with the patch.
This doesn't seem like a proper fix: this fixes the configure test, but surely rustc will be invoked later in the build process and need the exact same -L flag, otherwise linking Rust libraries will fail?
This is the odd point. We success later build process without it.
Reporter | ||
Comment 13•6 years ago
|
||
Updated•6 years ago
|
Comment 14•5 years ago
|
||
A similar configure failure can also happen with the arm*-unknown-linux-gnueabi family of targets: there's at least armv4t-unknown-linux-gnueabi, armv5te-unknown-linux-gnueabi and armv7-unknown-linux-gnueabi, all of which are currently considered to be (CPU=ARM, endian=little, ABI=linux-gnueabi).
armv6-unknown-netbsd-eabihf and armv7-unknown-netbsd-eabihf would probably have the same problem. I think the current situation is that configure will only succeed if the rust target you have installed happens to be the last one in rustc --print target-list
that the build system considers to match its simplified (CPU, endian, ABI) triple, which seems fragile: if rustc adds a new i686sse-unknown-linux-gnu or armv8-unknown-linux-gnueabi target, then people who are compiling for i686 or ARMv7 will find that their intended target is no longer the last one in the list.
Debian is in about the same situation as Yocto: our toolchain/infrastructure already knows which Rust target is the most appropriate, but there's currently no way to communicate that to the build system.
Comment 15•5 years ago
|
||
On Debian's ARM ports, unlike x86, there is not necessarily enough information in the GNU tuple to infer which rustc target is the most suitable: Debian armel configures with --target=arm-linux-gnueabi
, which in fact is meant to map to Rust --target=armv5te-unknown-linux-gnueabi
, but the build system doesn't have enough information to know that we didn't mean armv4t-unknown-linux-gnueabi
or armv5te-unknown-linux-gnueabi
.
Comment 16•5 years ago
|
||
(In reply to Simon McVittie from comment #15)
doesn't have enough information to know that we didn't mean
armv4t-unknown-linux-gnueabi
orarmv5te-unknown-linux-gnueabi
.
Sorry, that should have said: armv4t-unknown-linux-gnueabi
or armv7-unknown-linux-gnueabi
.
Comment 17•5 years ago
|
||
Configure does check what the C compiler targets by default, or with the flags the build system is given, and uses that as additional information to choose the rust target.
https://searchfox.org/mozilla-central/rev/202a285024f174c2d2bf2152d9cba90a03723eab/build/moz.configure/rust.configure#281
Updated•2 years ago
|
Description
•