Bug 12691

Summary: host-rust build fails
Product: buildroot Reporter: eyalroyee
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: alex, buildroot, jonah
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description eyalroyee 2020-03-22 16:59:21 UTC
Unable to build host-rust (version 1.33.0).
I'm trying to build host-rust on my Ubuntu 18.04 with buildroot on branch master (commit 35e845700fb15b4ab30678c073300b508db4eb95)

Steps to reproduce are:
1) select host-rust
2) make host-rust

The error is the following:
failed to parse TOML configuration 'config.toml': expected a table key, found a right bracket at line 15
failed to run: /home/eyal/buildroot/output/build/host-rust-1.33.0/build/bootstrap/debug/bootstrap build

It looks like the HOST_RUST_CONFIGURE_CMDS didn't generated a proper .toml file.
The 15th line in the generated .toml file is of the following format:
    echo '[target.$(RUSTC_TARGET_NAME)]';

I guess that should be some sort of validation for that variable before evaluating it.

Thanks,
Eyal
Comment 1 alex 2020-03-22 19:51:47 UTC
Hi,

What arch/libc are you using? Only some combinations of those work (I think only glibc). Check out:

http://buildroot-busybox.2317881.n4.nabble.com/PATCH-hack-to-be-able-to-build-Rust-targetting-MIPS-tp244931p244957.html

Cheers,

Álex
Comment 2 eyalroyee 2020-03-23 00:27:11 UTC
I'm using arm, little endian, cortex a7 for raspberrypi2 and uclibc.
When I tried to use glibc over uclibc the build was successful.
Comment 3 alex 2020-03-23 20:17:41 UTC
Yes, I think the Makefile does not support any uclibc build, even though it works. I needed to build Rust to target uclibc and I hardcoded things and it worked (this on mipsel).

I did something like this:

https://github.com/alexpdp7/retrofw2-rust/blob/master/0010-Hardcode-target-to-mipsel-uclibc-is-built.patch

The thread I linked contains more details. Also in the repo I collected some other interesting patches (updating Rust to a later version, patching the mipsel target to support the device I'm targetting, etc.).

I'm adding myself to the cc:, in case the buildroot devs add support for uclibc...
Comment 4 romain.naour 2020-05-08 15:47:16 UTC
Hi Eyal, Alex,

As a short therm solution, I suggested a patch that disable host-rust package when the target architecture is not supported by rust [1].

I'm not sure how upstream rust project is testing/supporting uClibc-ng or musl.

Note: The current rust version available in Buildroot is old, there is a patch series adding a Cargo package infrastructure and an update to rust 1.40 (1.43.1 is already available).

Feel free to send a followup patch to enable host-rust for uclibc target.

[1] http://patchwork.ozlabs.org/project/buildroot/patch/20200508152739.1625844-1-romain.naour@gmail.com/

Best regards,
Romain
Comment 5 Thomas Petazzoni 2020-05-17 19:23:02 UTC
Applied the patch proposed by Romain as https://git.buildroot.org/buildroot/commit/?id=4c051c65eee278e54a95ec0f5790e39f9af901c9