我已按照this link
成功创建了musl
已配置的rustc
当我使用cargo rustc -- --target=x86_64-unknown-linux-musl
'error: could not find crate `libc` with expected target triple x86_64-unknown-linux-musl'
然后,我尝试使用crate中的代码创建rust-libc
库。为了更准确,我使用cargo
提供的命令来构建rust-libc
,我只在命令中添加了--target=x86_64-unknown-linux-musl
。这次报告失败了:
'error: could not find native static library `c`, perhaps an -L flag is missing?`'
我有两个问题:
是否必须构建musl
已配置cargo
才能使用cargo build --target=x86_64-unknown-linux-musl
?
我该如何解决这个问题:
'error: could not find native static library `c`, perhaps an -L flag is missing?'
答案 0 :(得分:3)
这对我来说构建了libc:
rustc --target = x86_64-unknown-linux-musl /address-of-libc/lib.rs --crate-name libc --crate-type lib -L / address-of-musldist / musldist / lib / --out-dir = / your-chosen-address / target --cfg feature = \“default \” - cfg feature = \“cargo-build \” - event = dep-info,link