I'm working on a Yocto distribution with Scarthgap for the Raspberry Pi 4, I can successfully build a rust hello-world example within the image build. Now, I want to generate a toolchain to cross compile.
To include the Rust toolchain in my SDK, I added the following line to my configuration:
TOOLCHAIN_HOST_TASK:append = " nativesdk-rust nativesdk-cargo"
After building the SDK, I loaded the environment file from the SDK and attempted to cross-compile a simple "Hello, World!" Rust application using cargo. However, I encountered the following error:
$ cargo run
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "x86_64-oesdk-linux-gnu". Run `rustc --print target-list` for a list of built-in targets
$ rustc --print target-list
error: Error loading target specification: Could not find specification for target "x86_64-oesdk-linux-gnu". Run `rustc --print target-list` for a list of built-in targets
I couldn't find any resources or tutorials on this topic. I'm looking for guidance on using the SDK. Is cross-compiling Rust with the Yocto SDK still too new and not yet fully functional?