Rust ffi cross compile, can't find crate for std

I just have a simple rust ffi demo, I want to get a dynamic lib.
├── Cargo.toml
├── src


name = "dev_value"
version = "0.1.0"
authors = ["laurencechan]
edition = "2019"

crate-type = ["cdylib"]



pub extern "C" fn dec_value() {
println!("execute the rust lib by laurence!!!!!!!!!!!!!!!!!!!!!!!!!!!")

when i execute the command "cargo build --release --target=arm-unknown-linux-gnueabihf" in the project root path, I got this error message:

Compiling dev_value v0.1.0 (/home/dev_value)
error[E0463]: can't find crate for std

error: aborting due to previous error

For more information about this error, try rustc --explain E0463.
error: Could not compile dev_value.

To learn more, run the command again with --verbose.

It looks like you don't have a copy of std which is compiled for your desired target. The standard library is pre-compiled for each target, so you probably want to grab a copy using rustup target add arm-unknown-linux-gnueabihf.

thanks so much, It works after I do as you said :smiley:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.