我正在为Raspberry Pi交叉编译我的M1 Mac项目。该项目包含大约17Kloc,在Pi上构建它会耗尽可用内存(和1G的额外交换空间)。通过交叉编译器构建它会让我抱怨这个编译器
error occurred: Failed to find tool. Is `arm-linux-gnueabihf-binutils-gcc` installed?
..这是合理的,因为虽然外部链接器包arm-linux-gnueabihf-binutils
包括arm-linux-gnueabihf-binutils-ld
和arm-linux-gnueabihf-binutils-ranlib
以及其他熟悉的名称,但它缺少C编译器。
但是我在哪里可以得到它呢?不是在家酿AFAIKS上。这是问题的简化再现。$HOME/.cargo/config
为
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-ld"
Cargo.toml
为
[package]
name = "nics"
version = "0.1.0"
edition = "2021"
[dependencies]
network-interface = "0.1.3"
...和main.rs
是
use network_interface::{NetworkInterface, NetworkInterfaceConfig};
fn main() {
let nics = NetworkInterface::show().unwrap();
println!("Found {} NICs", nics.len());
for itf in nics.iter() {
println!("{:?}", itf);
}
}
在this otherwise splendid article之后,I
1.我安装了Rust的目标树莓派rustup target add armv7-unknown-linux-musleabihf
1.已安装连接器brew install arm-linux-gnueabihf-binutils
1.我尝试用cargo build --target armv7-unknown-linux-musleabihf
为Pi构建它
这不能说...
error: failed to run custom build command for `network-interface v0.1.3`
Caused by:
process didn't exit successfully: `/Users/martincowie/Development/rust/nics/target/debug/build/network-interface-77fc30e746fc938b/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("armv7-unknown-linux-musleabihf")
OPT_LEVEL = Some("0")
HOST = Some("aarch64-apple-darwin")
CC_armv7-unknown-linux-musleabihf = None
CC_armv7_unknown_linux_musleabihf = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_armv7-unknown-linux-musleabihf = None
CFLAGS_armv7_unknown_linux_musleabihf = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = None
running: "arm-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv7-a" "-mfpu=vfpv3-d16" "-Wall" "-Wextra" "-o" "/Users/martincowie/Development/rust/nics/target/armv7-unknown-linux-musleabihf/debug/build/network-interface-339c444064457e48/out/src/target/macos/ffi/lladdr.o" "-c" "src/target/macos/ffi/lladdr.c"
--- stderr
error occurred: Failed to find tool. Is `arm-linux-musleabihf-gcc` installed?
我在哪里可以得到arm-linux-musleabihf-gcc
,或者我没有看到什么更基本的问题?
1条答案
按热度按时间ymzxtsji1#
安装musl cross compiler toolchains可能有助于:
(免责声明:无法验证,没有Mac)