gpt4 book ai didi

rust - 调用cargo-binutils命令时,是否可以使用xbuild代替build?

转载 作者:行者123 更新时间:2023-12-03 11:31:37 24 4
gpt4 key购买 nike

我尝试通过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 ,我需要在sysrootrustflags中添加.cargo/config标志。

示例如下。

rustflags = ["--sysroot", "/full/path/to/sysroot/directory"]

在项目的目标目录中有sysroot目录。

如果添加了这些标志,那么cargo-bintuils命令将被启用以在我的环境中使用。

关于rust - 调用cargo-binutils命令时,是否可以使用xbuild代替build?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61305693/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com