Closed
Description
I'm kind of new to cross-compiling with rust, but I managed to set up a foreign rust-std, and also a gcc cross-compiler for linking. It's all in cargo's config:
$ cat >>~/.cargo/config
[target.armv7-unknown-linux-gnueabihf]
linker = "armv7a-unknown-linux-gnueabihf"
how to reproduce:
git clone https://github.com/nagisa/rust_libloading.git
cd rust_libloading
cargo build --target=armv7-unknown-linux-gnueabihf
Updating crates.io index
Compiling cc v1.0.31
Compiling libloading v0.5.0 (/tmp/rust_libloading)
error: failed to run custom build command for `libloading v0.5.0 (/tmp/rust_libloading)`
process didn't exit successfully: `/tmp/rust_libloading/target/debug/build/libloading-a41fce1a7453006f/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=dl
TARGET = Some("armv7-unknown-linux-gnueabihf")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_armv7-unknown-linux-gnueabihf = None
CC_armv7_unknown_linux_gnueabihf = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_armv7-unknown-linux-gnueabihf = None
CFLAGS_armv7_unknown_linux_gnueabihf = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = None
running: "arm-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv7-a" "-Wall" "-Wextra" "-o" "/tmp/rust_libloading/target/armv7-unknown-linux-gnueabihf/debug/build/libloading-b5a400997b94cd58/out/src/os/unix/global_static.o" "-c" "src/os/unix/global_static.c"
--- stderr
thread 'main' panicked at '
Internal error occurred: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?
', /home/user/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cc-1.0.31/src/lib.rs:2367:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.