1## Introduction 2 3This provides the Rust compiler, tools for building packages (cargo), and 4a few example projects. 5 6## What works: 7 8 - Building `rust-native` and `cargo-native` 9 - Building Rust based projects with Cargo for the TARGET 10 - e.g. `rustfmt` which is used by the CI system 11 - `-buildsdk` and `-crosssdk` packages 12 13## What doesn't: 14 15 - Using anything but x86_64 or arm64 as the build environment 16 - rust (built for target) [issue #81](https://github.com/meta-rust/meta-rust/issues/81) 17 18## What's untested: 19 20 - cargo (built for target) 21 22## Building a rust package 23 24When building a rust package in bitbake, it's usually easiest to build with 25cargo using cargo.bbclass. If the package already has a Cargo.toml file (most 26rust packages do), then it's especially easy. Otherwise you should probably 27get the code building in cargo first. 28 29Once your package builds in cargo, you can use 30[cargo-bitbake](https://github.com/cardoe/cargo-bitbake) to generate a bitbake 31recipe for it. This allows bitbake to fetch all the necessary dependent 32crates, as well as a pegged version of the crates.io index, to ensure maximum 33reproducibility. Once the Rust SDK support is added to oe-core, cargo-bitbake 34may also be added to the SDK. 35 36NOTE: You will have to edit the generated recipe based on the comments 37contained within it 38 39## TODO 40 41## Pitfalls 42 43 - TARGET_SYS _must_ be different from BUILD_SYS. This is due to the way Rust configuration options are tracked for different targets. This is the reason we use the Yocto triples instead of the native Rust triples. See rust-lang/cargo#3349. 44 45## Dependencies 46 47On the host: 48 - Any `-sys` packages your project might need must have RDEPENDs for 49 the native library. 50 51On the target: 52 - Any `-sys` packages your project might need must have RDEPENDs for 53 the native library. 54 55## Copyright 56 57MIT OR Apache-2.0 - Same as rust 58 59