我尝试通过cargo xbuild
命令将binutils命令用于自定义构建目标的二进制文件。
但是,我收到类似以下消息的错误。
$ cargo nm --target i586-rust_dos.json --bin rust_dos --verbose
"cargo" "build" "--target" "i586-rust_dos.json" "--bin" "rust_dos" "--message-format=json"
Compiling rust_dos v0.1.0 (/home/soya/Documents/src/rust/prac/rust_dos)
error[E0463]: can't find crate for `core` ] 0/2
|
= note: the `i586-rust_dos-8410465322435951119` 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 `rust_dos`.
To learn more, run the command again with --verbose.
error: Failed to parse crate metadata
我意识到
cargo nm
使用cargo build
命令,所以我认为如果我使
cargo nm
使用cargo xbuild
而不是cargo build
,则应该解决此错误。但是,我找不到该怎么做。
如果可以的话,请教我。
最佳答案
要检测使用core
构建的cargo xbuild
crate ,我需要在sysroot
的rustflags
中添加.cargo/config
标志。
示例如下。
rustflags = ["--sysroot", "/full/path/to/sysroot/directory"]
在项目的目标目录中有sysroot目录。
如果添加了这些标志,那么cargo-bintuils命令将被启用以在我的环境中使用。
关于rust - 调用cargo-binutils命令时,是否可以使用xbuild代替build?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61305693/