小编M M*_*eli的帖子

当rustc启用musc时,未能使用货物建立rust-libc

我通过以下链接成功创建了一个musl配置rustc

当我使用时,我尝试构建一个项目(使用非musl配置生锈建立良好)失败了 cargo rustc -- --target=x86_64-unknown-linux-musl

 'error: could not find crate `libc` with expected target triple x86_64-unknown-linux-musl'
Run Code Online (Sandbox Code Playgroud)

然后,我尝试rust-libc使用来自crate的代码创建库.为了更准确,我使用了提供的命令cargo来构建rust-libc,我只添加--target=x86_64-unknown-linux-musl到命令中.这次报告失败了:

'error: could not find native static library `c`, perhaps an -L flag is missing?`'
Run Code Online (Sandbox Code Playgroud)

我有两个问题:

  • 是否必须构建musl配置cargo为能够使用cargo build --target=x86_64-unknown-linux-musl

  • 我该如何解决这个问题:

    'error: could not find native static library `c`, perhaps an -L flag is missing?'
    
    Run Code Online (Sandbox Code Playgroud)

rust rust-cargo musl

6
推荐指数
1
解决办法
704
查看次数

标签 统计

musl ×1

rust ×1

rust-cargo ×1