cancel
Showing results for 
Search instead for 
Did you mean: 

Adding support for rust 1.78 to OpenSTLinux

HSant.1
Associate II

Hello,
I'm a newbie using Yocto so my question maybe doesn't make a lot of sense.
I'm trying to add rust 1.78 to an existing image (STM32MP1 OpenSTLinux).

1. I cloned the repo in the layers directory (git clone https://github.com/meta-rust/meta-rust.git) .
2. I sourced my environment script (DISTRO=openstlinux-weston MACHINE=stm32mp15-disco IMAGE=st-image-weston source layers/meta-st/scripts/envsetup.sh)
3. I modified the file "layers/openembedded-core/meta/conf/distro/include/tcmode-default.inc" in order to change RUSTVERSION ?= "1.68%" to RUSTVERSION ?= "1.78%"
4. I run bitbake-layers add-layer meta-rust
5. I run bitbake-layers show-layers (my new layer is there : (rust-layer /home/hanoi/devel/STM32MP1/distribution-package/layers/meta-rust))
6. I compile the image (bitbake st-image-weston)
7. I can see the source files for rust-native-1.78.0-r0, cargo-native-1.78.0-r0 and rust-llvm-native-1.78.0-r0 are being fetched and unpacked

Now the problems:
compiling rust-native-1.78.0-r0
-------------------------------------------------------//--------------------------------------------------------------
ERROR: rust-native-1.78.0-r0 do_compile: ExecutionError('/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/temp/run.do_compile.3318339', 1, None, None)
ERROR: Logfile of failure stored in: /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/temp/log.do_compile.3318339
Log data follows:
| DEBUG: Executing shell function do_compile
| COMPILE rust-native build --stage 2
| Building bootstrap
| running: /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rust-snapshot/bin/cargo build --manifest-path /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/Cargo.toml --verbose --frozen
| error: could not load Cargo configuration
|
| Caused by:
| could not parse TOML configuration in `/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/cargo_home/config`
|
| Caused by:
| TOML parse error at line 26, column 1
| |
| 26 | [target.x86_64-unknown-linux-gnu]
| | ^
| invalid table header
| duplicate key `x86_64-unknown-linux-gnu` in table `target`
| Traceback (most recent call last):
| File "/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/bootstrap.py", line 1179, in <module>
| main()
| File "/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/bootstrap.py", line 1164, in main
| bootstrap(args)
| File "/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/bootstrap.py", line 1131, in bootstrap
| build.build_bootstrap()
| File "/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/bootstrap.py", line 882, in build_bootstrap
| run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
| File "/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/bootstrap.py", line 187, in run
| raise RuntimeError(err)
| RuntimeError: failed to run: /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rust-snapshot/bin/cargo build --manifest-path /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/rustc-1.78.0-src/src/bootstrap/Cargo.toml --verbose --frozen
| WARNING: exit code 1 from a shell command.
ERROR: Task (virtual:native:/home/hanoi/devel/STM32MP1/distribution-package/layers/meta-rust/recipes-devtools/rust/rust_1.78.0.bb:do_compile) failed with exit code '1'
-------------------------------------------------------//--------------------------------------------------------------

8. I "fixed" that editing /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/cargo_home/config
and removing the duplicated section:

[target.x86_64-unknown-linux-gnu]
linker = '/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/rust-native/1.78.0-r0/wrapper/build-rust-ccld'

9. Start compiling again (bitbake st-image-weston)

10. after compiling some more packages I got this error compiling cargo-native and I don't know how to fix that
-----------------------------------------------//-----------------------------------------------------
ERROR: cargo-native-1.78.0-r0 do_compile: ExecutionError('/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/temp/run.do_compile.3352513', 101, None, None)
ERROR: Logfile of failure stored in: /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/temp/log.do_compile.3352513
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: Using rust targets from /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/rust-targets/
| NOTE: cargo = /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/cargo-1.77.0-x86_64-unknown-linux-gnu/bin/cargo
| NOTE: /home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/cargo-1.77.0-x86_64-unknown-linux-gnu/bin/cargo build -v --offline --target x86_64-unknown-linux-gnu --release --manifest-path=/home/hanoi/devel/STM32MP1/distribution-package/build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work/x86_64-linux/cargo-native/1.78.0-r0/rustc-1.78.0-src/src/tools/cargo//Cargo.toml
| error: process didn't exit successfully: `rustc -vV` (exit status: 1)
| --- stdout
| rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball)
| binary: rustc
| commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
| commit-date: 2024-04-29
| host: x86_64-linux
| release: 1.78.0
|
| --- stderr
| error: Error loading target specification: Could not find specification for target "x86_64-linux". Run `rustc --print target-list` for a list of built-in targets
|
|
| WARNING: exit code 101 from a shell command.
ERROR: Task (virtual:native:/home/hanoi/devel/STM32MP1/distribution-package/layers/meta-rust/recipes-devtools/cargo/cargo_1.78.0.bb:do_compile) failed with exit code '1'
-----------------------------------------------//-----------------------------------------------------

 

That's my build configuration
Build Configuration:
BB_VERSION = "2.4.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-22.04"
TARGET_SYS = "arm-ostl-linux-gnueabi"
MACHINE = "stm32mp15-disco"
DISTRO = "openstlinux-weston"
DISTRO_VERSION = "4.2.2-snapshot-20240617"
TUNE_FEATURES = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU = "hard"
DISTRO_CODENAME = "mickledore"
ACCEPT_EULA_stm32mp15-disco = "1"
GCCVERSION = "12.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-python
meta-oe
meta-gnome
meta-initramfs
meta-multimedia
meta-networking
meta-webserver
meta-filesystems
meta-perl = "HEAD:03fd1d368ac19793b3e4c35159ba2ce802247e4d"
meta-st-stm32mp = "HEAD:5e5b99ba054276d10b4afec2b80962de3455b0a1"
meta-qt5 = "HEAD:cf6ffcbad5275a3428f6046468a0c9d572e813d1"
meta-st-openstlinux = "HEAD:6526808593a93f5da31dbb05dd5b0bc3d27d4d2c"
meta = "HEAD:3ef283e02b0b91daf64c3a589e1f6bb68d4f5aa1"
meta-rust = "master:81d0fbfc023e987068ea1c035e33d6f0ad175cd1"


Can you help me compiling the image, or give a hint about it, or maybe there's another way completely different  ?
Thanks a lot !

1 REPLY 1
Bernard PUEL
ST Employee

Hello, Did you look at this article = https://wiki.st.com/stm32mpu/wiki/How_to_develop_a_Rust_Application

Recently ST added Rust SDK addons for x86 linux platform, could it help you to rapidly dev your own application ?