如何解决我们如何为 riscv-linux 交叉编译静态链接的 rust 程序?
我发现目标 riscv64gc-unknown-linux-musl 可能会有所帮助。当我尝试添加目标时,我被告知
工具链“nightly-x86_64-unknown-linux-gnu”不包含 目标'riscv64gc-unknown-linux-musl'的组件'rust-std'
帮助:考虑改用cargo build -Z build-std
所以我运行了这个命令,“cargo build -Z build-std --target riscv64gc-unknown-linux-musl”,但是得到了很多编译错误:
error[E0412]: cannot find type `c_char` in the crate root
--> /home/simon/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/libc-0.2.93/src/unix/mod.rs:45:29
|
6 | pub type c_schar = i8;
| ---------------------- similarly named type alias `c_schar` defined here
...
45 | pub gr_name: *mut ::c_char,| ^^^^^^ help: a type alias with a similar name exists: `c_schar`
>error[E0412]: cannot find type `c_char` in the crate root
--> /home/simon/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/libc-0.2.93/src/unix/mod.rs:46:31
|
6 | pub type c_schar = i8;
| ---------------------- similarly named type alias `c_schar` defined here
...
46 | pub gr_passwd: *mut ::c_char,| ^^^^^^ help: a type alias with a similar name exists: `c_schar`
error: aborting due to 679 previous errors
部分错误有详细解释:E0412、E0425、E0573。
有关错误的详细信息,请尝试 rustc --explain E0412
。
error: could not compile `libc`
我如何理解 build-std 的细节并使其工作?通过阅读cargo和rust的源码?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。