[Buildroot] "PATCH": hack to be able to build Rust targetting MIPS
alex at corcoles.net
Wed Feb 5 17:21:58 UTC 2020
Some further investigation reveals that Rust made the mips* targets
mips32r2 by default, while the system I'm trying to compile to is only
mips32 (no r2). This seems to be the source of my issues:
So if buildroot wants Rust to work on JZ4760B and similar popular CPUs, I
think it should define a new Rust target for mips32 without r2 instruction
That goes a bit beyond my knowledge (esp. buildroot), so if someone wants
to help, I'd be happy to do whatever I can.
On Mon, Feb 3, 2020 at 6:08 PM Alex Corcoles <alex at corcoles.net> wrote:
> I've finally had more time to play with this. It seems that
> mipsel-unknown-linux-uclibc works! I've been able to run software built
> with it on a real hardware device, although it's very crashy (all
> arithmetic operations seem to crash with illegal instruction- probably I
> didn't configure my toolchain right or there's a Rust issue...).
> I would suggest removing the limitation on uclibc... perhaps with a big
> warning flag, though, as I haven't managed to build complex, stable
> I've written a bit about the process at:
> On Mon, Jan 20, 2020 at 5:31 PM Alex Corcoles <alex at corcoles.net> wrote:
>> The RUSTC_TARGET_NAME variable is defined in rustc.mk only if the symbol
>>> BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is selected. This symbols is
>>> used to ensure all the conditions to build a rust package are met. One
>>> of them is that the toolchain is glibc-based. This is required, because
>>> the standard library provided by the pre-built host Rust toolchain is
>>> built against glibc.
>>> In your defconfig, the toolchain is uclibc-based and the host Rust
>>> toolchain is built from source.
>>> Hence BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is not defined and so
>>> is RUSTC_TARGET_NAME.
>>> So there is a bug: the restriction on having a glibc-based toolchain
>>> should apply either when using a pre-built rust toolchain or building
>>> one from source. I'll see how to fix it.
>>> The list of supported platforms  mentions GNU glibc and musl, but not
>>> uclibc. Does the build with your defconfig and patch successful?
>>>  https://forge.rust-lang.org/release/platform-support.html
>> I think I built it successfully after introducing my hack, but as far as
>> I understand, it is not guaranteed to build in the future (and the opposite
>> is true, perhaps if it doesn't build today, it will tomorrow). In the link
>> you sent, mipsel-unknown-linux-uclibc is Tier 3 with std.
>> If I have some time I will play around with it and see you some results.
>> IMHO, perhaps you should hide non Tier-1 platforms behind an "enable this
>> option for non-Tier 1 Rust builds which are not guaranteed to work", or
>> something like that.
>> ( Y )
>> ()~*~() mail: alex at corcoles dot net
>> (_)-(_) http://alex.corcoles.net/
> ( Y )
> ()~*~() mail: alex at corcoles dot net
> (_)-(_) http://alex.corcoles.net/
( Y )
()~*~() mail: alex at corcoles dot net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the buildroot