Based on this comment,应该可以使用Xargo管理特定目标的自定义core
条件箱的安装。我已尝试以下方法让它使用除core
之外没有其他依赖关系的包:
Cargo.toml
:没有列出依赖项
[package]
name = "chip8-engine"
version = "0.1.0"
authors = ["Dr. ERDI Gergo <gergo@erdi.hu>"]
[dependencies]
Xargo.toml
:我列出了core
[target.avr-atmel-none.dependencies]
core = { git = "https://github.com/gergoerdi/rust-avr-libcore-mini", rev = "adda44aa91ac517aab6915447592ee4cad26564c" }
但是,通过xargo build
构建失败,就像我刚刚使用cargo
:
$ ~/.cargo/bin/xargo build --release -v --target avr-atmel-none
+ "rustc" "--print" "sysroot"
+ "cargo" "build" "--release" "-v" "--target" "avr-atmel-none"
Compiling chip8-engine v0.1.0 (file:///home/cactus/prog/rust/avr/chip8-engine-avr)
Running `stage1/bin/rustc --crate-name chip8_engine src/lib.rs --crate-type lib -C opt-level=3 -C metadata=231962fc6e1bee04 -C extra-filename=-231962fc6e1bee04 --out-dir /home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps --emit=dep-info,link --target avr-atmel-none -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/release/deps`
error[E0463]: can't find crate for `core`
|
= note: the `avr-atmel-none` target may not be installed
error: aborting due to previous error
error: Could not compile `chip8-engine`.
Caused by:
process didn't exit successfully: `stage1/bin/rustc --crate-name chip8_engine src/lib.rs --crate-type lib -C opt-level=3 -C metadata=231962fc6e1bee04 -C extra-filename=-231962fc6e1bee04 --out-dir /home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps --emit=dep-info,link --target avr-atmel-none -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/release/deps` (exit code: 101)
请注意,即使尝试过Git流量也没有任何说明。
相比之下,如果我将cargo
行放在core = { git = ...}
而不是Cargo.toml
中,那么这就是我的Xargo.toml
输出,这可以正常工作:< / p>
$ cargo build -v --target=avr-atmel-none --release
Compiling core v0.1.0 (https://github.com/gergoerdi/rust-avr-libcore-mini?rev=adda44aa91ac517aab6915447592ee4cad26564c#adda44aa)
Running `stage1/bin/rustc --crate-name core /home/cactus/.cargo/git/checkouts/rust-avr-libcore-mini-37e279d93a70b45a/adda44a/src/lib.rs --crate-type lib -C opt-level=3 -C metadata=47f38a1987c5b284 -C extra-filename=-47f38a1987c5b284 --out-dir /home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps --emit=dep-info,link --target avr-atmel-none -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/release/deps --cap-lints allow`
Compiling chip8-engine v0.1.0 (file:///home/cactus/prog/rust/avr/chip8-engine-avr)
Running `stage1/bin/rustc --crate-name chip8_engine src/lib.rs --crate-type lib -C opt-level=3 -C metadata=231962fc6e1bee04 -C extra-filename=-231962fc6e1bee04 --out-dir /home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps --emit=dep-info,link --target avr-atmel-none -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps -L dependency=/home/cactus/prog/rust/avr/chip8-engine-avr/target/release/deps --extern core=/home/cactus/prog/rust/avr/chip8-engine-avr/target/avr-atmel-none/release/deps/libcore-47f38a1987c5b284.rlib`
Finished release [optimized] target(s) in 15.21 secs
答案 0 :(得分:1)
您可能需要安装每晚Rust工具链,以允许xargo为您的目标构建一些支持代码。我不得不做类似的事情,让嵌入式ARM设置与xargo一起工作。在嵌入式目标的目录中执行此操作:
$ rustup install nightly
$ rustup component add rust-src # needed for xargo buildup of the target
$ rustup override set nightly # sets the rustc version to run for this dir
$ xargo build
答案 1 :(得分:1)
结果是picking up rustc
's path from .cargo/config
is not currently supported by Xargo,因此无论我想要使用的rustc
是什么,都需要安装为rustup link
。引用上述票:
在意外中,您可以使用
rustup
创建指向stage1rustc
的自定义工具链。这已知可行。$ cd /home/cactus/prog/rust/rust-avr/build/build/x86_64-unknown-linux-gnu/stage1 $ rustup toolchain link avr-toolchain . $ rustup default avr-toolchain $ rustc -V # should say dev channel