今天开始我在CS140e上的工作时,我已经完成了该项目的第3阶段(编写C代码以直接与Raspberry Pi 3上的GPIO引脚进行对话,这只会使LED闪烁),但是在第4阶段,一旦我尝试在Rust中编译我的解决方案,rustc
似乎无法找到aarch64-none-elf
目标:
➜ phase4 git:(master) ✗ make
+ Building target/aarch64-none-elf/release/libblinky.a [xargo --release]
WARNING: the sysroot can't be built for the Stable channel. Switch to nightly.
warning: `panic` setting is ignored for `test` profile
Compiling rlibc v1.0.0
error[E0463]: can't find crate for `core`
|
= note: the `aarch64-none-elf` target may not be installed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: Could not compile `rlibc`.
To learn more, run the command again with --verbose.
Makefile:35: recipe for target 'target/aarch64-none-elf/release/libblinky.a' failed
make: *** [target/aarch64-none-elf/release/libblinky.a] Error 101
,实际上rustc --print target-list
不包括aarch64-none-elf
:
➜ phase4 git:(master) ✗ rustc --print target-list
aarch64-linux-android
aarch64-unknown-cloudabi
aarch64-unknown-freebsd
aarch64-unknown-fuchsia
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
aarch64-unknown-openbsd
...
尽管我已经安装了工具链:
➜ phase4 git:(master) ✗ whereis aarch64-none-elf-gcc
aarch64-none-elf-gcc: /usr/local/bin/aarch64-none-elf/bin/aarch64-none-elf-gcc
此外,我还有一个名为aarch64-none-elf.json
的自定义目标文件,其中包含以下内容(在构建时可能会传递给xargo
):
{
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "aarch64",
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
"executables": true,
"linker": "aarch64-none-elf-ld",
"linker-flavor": "ld",
"linker-is-gnu": true,
"llvm-target": "aarch64-unknown-none",
"no-compiler-rt": true,
"features": "+a53,+strict-align",
"max-atomic-width": 128,
"os": "none",
"panic": "abort",
"panic-strategy": "abort",
"position-independent-executables": true,
"target-c-int-width": "32",
"target-endian": "little",
"target-pointer-width": "64",
"disable-redzone": true
}
答案 0 :(得分:2)
原来我需要做的就是运行rustup default nightly
并使用rustc
的夜间版本,如警告中所述,我能够克服该错误。如果有人想解释为什么,那就太好了。
➜ phase4 git:(master) ✗ rustc --version
rustc 1.30.0-nightly (33b923fd4 2018-08-18)