Rust: 错误:与`cc` 链接失败:退出代码:1(仅在过去两周内出现)

创建于 2015-05-11  ·  52评论  ·  资料来源: rust-lang/rust

这是rust-portaudio板条箱中的问题。

Travis 最近开始在夜间和测试版以及我的本地机器上失败(见这里),尽管大约两周前在上述所有方面都运行良好(自上次运行良好以来,repo 没有任何变化)。

板条箱本身构建良好,但是两个示例都会导致链接错误(上面链接)发生。

@alexcrichton我认为这可能与 #16734 有关,但是我还没有能够开发出解决方法或确定 repo 中问题的直接来源。 我也无法解释为什么它只会在过去两周内开始发生。 只是想我会发布以防万一您(或其他任何人)有任何想法。

最有用的评论

2年后,这种情况似乎还在发生? +1

所有52条评论

错误日志似乎已更改或消失,您能否提供一组新的错误日志?

@alexcrichton啊,抱歉! 这是最新的错误日志

迷人! 我相信这可能是一个 Cargo 错误而不是 Rust 错误,但它......绝对有趣。 这里的问题是链接器被这样调用:

cc -o foo/libfoo.so -L foo -lfoo

在这种情况下, foo对您来说是portaudio ,但是你们俩都生成了一个名为libportaudio.so _and_ 的动态库,链接到(我假设)系统libportaudio.so . 不幸的是,这些名称是相同的,因此链接器似乎正在创建输出libportaudio.so文件 _first_,然后尝试将其链接(但由于无效而出错)。

tl;博士; 这是由https://github.com/rust-lang/cargo/commit/27efa7ba03a2054bf8b62f8d5c568918b7d35b0d引起的,将通过重命名您的 crate 或不构建 dylib 来解决。

不过,我现在要关闭它,因为它不是 Rust 错误。 但是,如果您有兴趣让这个用例工作,您能否打开一个针对 Cargo 的错误以在顶级文件名中重新添加哈希? 似乎添加了一个合理的配置:)

我在 Ubuntu 12.04

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

$ sudo cargo build --verbose > cargo.log 2>&1
   Compiling bitflags v0.1.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/bitflags-0.1.1/src/lib.rs --crate-name bitflags --crate-type lib -g -C metadata=dd68b8369bcd8ff0 -C extra-filename=-dd68b8369bcd8ff0 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling byteorder v0.3.10
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/byteorder-0.3.10/src/lib.rs --crate-name byteorder --crate-type lib -g -C metadata=399c175f6a7726ac -C extra-filename=-399c175f6a7726ac --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling matches v0.1.2
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/matches-0.1.2/lib.rs --crate-name matches --crate-type lib -g -C metadata=68291f81832fc22d -C extra-filename=-68291f81832fc22d --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling rustc-serialize v0.3.15
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/rustc-serialize-0.3.15/src/lib.rs --crate-name rustc_serialize --crate-type lib -g -C metadata=c1e8163a38ed3d54 -C extra-filename=-c1e8163a38ed3d54 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling unicode-width v0.1.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/unicode-width-0.1.1/src/lib.rs --crate-name unicode_width --crate-type lib -g --cfg feature=\"default\" -C metadata=130fd712a1a101ee -C extra-filename=-130fd712a1a101ee --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling ansi_term v0.5.2
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/ansi_term-0.5.2/src/ansi_term.rs --crate-name ansi_term --crate-type lib -g -C metadata=099aa38433e28470 -C extra-filename=-099aa38433e28470 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling threadpool v0.1.4
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/threadpool-0.1.4/src/lib.rs --crate-name threadpool --crate-type lib -g -C metadata=7afb0ed74cdfb4ee -C extra-filename=-7afb0ed74cdfb4ee --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling pkg-config v0.3.5
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/pkg-config-0.3.5/src/lib.rs --crate-name pkg_config --crate-type lib -g -C metadata=8cd0cf26131c0646 -C extra-filename=-8cd0cf26131c0646 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling gcc v0.3.8
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.8/src/lib.rs --crate-name gcc --crate-type lib -g -C metadata=f054ee6639177d8d -C extra-filename=-f054ee6639177d8d --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling libc v0.1.8
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.8/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"cargo-build\" --cfg feature=\"default\" -C metadata=ef5cbad4ef5c7a1e -C extra-filename=-ef5cbad4ef5c7a1e --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling natord v1.0.8
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs --crate-name natord --crate-type lib -g -C metadata=a05c856d0c2a4fbf -C extra-filename=-a05c856d0c2a4fbf --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:88:34: 97:26 note: shadowed label `'digits` declared here
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:88                         'digits: loop {
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:89                             read_left!();
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:90                             read_right!();
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:91                             match (ll, rr) {
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:92                                 (Some(ll_), Some(rr_)) => return_unless_equal!(ll_.cmp(&rr_)),
/home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/natord-1.0.8/lib.rs:93                                 (Some(_), None) => return Greater,
                                                                                   ...
   Compiling regex-syntax v0.1.2
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/regex-syntax-0.1.2/src/lib.rs --crate-name regex_syntax --crate-type lib -g -C metadata=74cdf8e4e9018a0c -C extra-filename=-74cdf8e4e9018a0c --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -Awarnings`
   Compiling term_grid v0.1.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/term_grid-0.1.1/src/lib.rs --crate-name term_grid --crate-type lib -g -C metadata=94d230454780f24c -C extra-filename=-94d230454780f24c --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern unicode_width=/home/alanb/src/git/hub/exa/target/debug/deps/libunicode_width-130fd712a1a101ee.rlib -Awarnings`
   Compiling pad v0.1.4
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/pad-0.1.4/src/lib.rs --crate-name pad --crate-type lib -g -C metadata=8b41ff1b2f475326 -C extra-filename=-8b41ff1b2f475326 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern unicode_width=/home/alanb/src/git/hub/exa/target/debug/deps/libunicode_width-130fd712a1a101ee.rlib -Awarnings`
   Compiling tz v0.2.0
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/tz-0.2.0/src/lib.rs --crate-name tz --crate-type lib -g -C metadata=908fc5615f8315f2 -C extra-filename=-908fc5615f8315f2 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern byteorder=/home/alanb/src/git/hub/exa/target/debug/deps/libbyteorder-399c175f6a7726ac.rlib -Awarnings`
   Compiling memchr v0.1.3
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/memchr-0.1.3/src/lib.rs --crate-name memchr --crate-type lib -g -C metadata=38e2ee286f7e4bdb -C extra-filename=-38e2ee286f7e4bdb --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling users v0.4.2
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/users-0.4.2/src/lib.rs --crate-name users --crate-type lib -g -C metadata=20f00ef534fe78a3 -C extra-filename=-20f00ef534fe78a3 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling num_cpus v0.2.6
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/num_cpus-0.2.6/src/lib.rs --crate-name num_cpus --crate-type lib -g -C metadata=16707c6acca9fe91 -C extra-filename=-16707c6acca9fe91 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling rand v0.3.8
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/rand-0.3.8/src/lib.rs --crate-name rand --crate-type lib -g -C metadata=de6cdb9e4fd93d55 -C extra-filename=-de6cdb9e4fd93d55 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling log v0.3.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/log-0.3.1/src/lib.rs --crate-name log --crate-type lib -g -C metadata=8a6aba167994951e -C extra-filename=-8a6aba167994951e --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling aho-corasick v0.2.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/aho-corasick-0.2.1/src/lib.rs --crate-name aho_corasick --crate-type lib -g -C metadata=068913d97bcdea39 -C extra-filename=-068913d97bcdea39 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern memchr=/home/alanb/src/git/hub/exa/target/debug/deps/libmemchr-38e2ee286f7e4bdb.rlib -Awarnings`
   Compiling libz-sys v0.1.6
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.6/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /home/alanb/src/git/hub/exa/target/debug/build/libz-sys-78922e0e40333890 --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern pkg_config=/home/alanb/src/git/hub/exa/target/debug/deps/libpkg_config-8cd0cf26131c0646.rlib -Awarnings`
   Compiling libgit2-sys v0.2.18 (https://github.com/alexcrichton/git2-rs.git#889cf3dd)
     Running `rustc /home/alanb/.cargo/git/checkouts/git2-rs-8b74d411676c498c/master/libgit2-sys/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /home/alanb/src/git/hub/exa/target/debug/build/libgit2-sys-ee62f8ed694e2d9b --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern pkg_config=/home/alanb/src/git/hub/exa/target/debug/deps/libpkg_config-8cd0cf26131c0646.rlib -Awarnings`
   Compiling libssh2-sys v0.1.26
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.26/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2 --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern pkg_config=/home/alanb/src/git/hub/exa/target/debug/deps/libpkg_config-8cd0cf26131c0646.rlib -Awarnings`
   Compiling openssl-sys v0.6.3
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.3/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7 --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern gcc=/home/alanb/src/git/hub/exa/target/debug/deps/libgcc-f054ee6639177d8d.rlib --extern pkg_config=/home/alanb/src/git/hub/exa/target/debug/deps/libpkg_config-8cd0cf26131c0646.rlib -Awarnings`
   Compiling getopts v0.2.11
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/getopts-0.2.11/src/lib.rs --crate-name getopts --crate-type lib -g -C metadata=1dade5d0522f070b -C extra-filename=-1dade5d0522f070b --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern log=/home/alanb/src/git/hub/exa/target/debug/deps/liblog-8a6aba167994951e.rlib -Awarnings`
     Running `/home/alanb/src/git/hub/exa/target/debug/build/libz-sys-78922e0e40333890/build-script-build`
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.6/src/lib.rs --crate-name libz_sys --crate-type lib -g -C metadata=78922e0e40333890 -C extra-filename=-78922e0e40333890 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings -L native=/usr/lib/x86_64-linux-gnu -l z`
     Running `/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/build-script-build`
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.3/src/lib.rs --crate-name openssl_sys --crate-type lib -g -C metadata=f1940735b7e345d7 -C extra-filename=-f1940735b7e345d7 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/out -l ssl -l crypto -l static=old_openssl_shim`
     Running `/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/build-script-build`
   Compiling regex v0.1.38
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/regex-0.1.38/src/lib.rs --crate-name regex --crate-type lib -g --cfg feature=\"pattern\" -C metadata=32ebc1f1da8b6841 -C extra-filename=-32ebc1f1da8b6841 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern regex_syntax=/home/alanb/src/git/hub/exa/target/debug/deps/libregex_syntax-74cdf8e4e9018a0c.rlib --extern aho_corasick=/home/alanb/src/git/hub/exa/target/debug/deps/libaho_corasick-068913d97bcdea39.rlib --extern memchr=/home/alanb/src/git/hub/exa/target/debug/deps/libmemchr-38e2ee286f7e4bdb.rlib -Awarnings`
     Running `/home/alanb/src/git/hub/exa/target/debug/build/libgit2-sys-ee62f8ed694e2d9b/build-script-build`
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.26/lib.rs --crate-name libssh2_sys --crate-type lib -g -C metadata=197403f26ef746c2 -C extra-filename=-197403f26ef746c2 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libz_sys=/home/alanb/src/git/hub/exa/target/debug/deps/liblibz_sys-78922e0e40333890.rlib --extern openssl_sys=/home/alanb/src/git/hub/exa/target/debug/deps/libopenssl_sys-f1940735b7e345d7.rlib --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -l static=ssh2 -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/out`
   Compiling regex_macros v0.1.20
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/regex_macros-0.1.20/src/lib.rs --crate-name regex_macros --crate-type dylib -C prefer-dynamic -g -C metadata=a3af5052cb03f830 -C extra-filename=-a3af5052cb03f830 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern regex=/home/alanb/src/git/hub/exa/target/debug/deps/libregex-32ebc1f1da8b6841.rlib -Awarnings`
   Compiling num v0.1.25
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/num-0.1.25/src/lib.rs --crate-name num --crate-type lib -g --cfg feature=\"rustc-serialize\" --cfg feature=\"default\" --cfg feature=\"rand\" --cfg feature=\"rational\" --cfg feature=\"bigint\" --cfg feature=\"complex\" -C metadata=7ad397ad0b46ae38 -C extra-filename=-7ad397ad0b46ae38 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern rustc_serialize=/home/alanb/src/git/hub/exa/target/debug/deps/librustc_serialize-c1e8163a38ed3d54.rlib --extern rand=/home/alanb/src/git/hub/exa/target/debug/deps/librand-de6cdb9e4fd93d55.rlib -Awarnings`
   Compiling url v0.2.35
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/url-0.2.35/src/lib.rs --crate-name url --crate-type lib -g -C metadata=a74304d08ea0134d -C extra-filename=-a74304d08ea0134d --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern rustc_serialize=/home/alanb/src/git/hub/exa/target/debug/deps/librustc_serialize-c1e8163a38ed3d54.rlib --extern matches=/home/alanb/src/git/hub/exa/target/debug/deps/libmatches-68291f81832fc22d.rlib -Awarnings`
   Compiling number_prefix v0.2.4
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/number_prefix-0.2.4/src/lib.rs --crate-name number_prefix --crate-type lib -g -C metadata=790423cf7d755cf7 -C extra-filename=-790423cf7d755cf7 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern num=/home/alanb/src/git/hub/exa/target/debug/deps/libnum-7ad397ad0b46ae38.rlib -Awarnings`
   Compiling locale v0.1.8
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/locale-0.1.8/src/lib.rs --crate-name locale --crate-type lib -g -C metadata=c1d2b96a2e42e568 -C extra-filename=-c1d2b96a2e42e568 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern num=/home/alanb/src/git/hub/exa/target/debug/deps/libnum-7ad397ad0b46ae38.rlib --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings`
   Compiling datetime v0.2.1
     Running `rustc /home/alanb/.cargo/registry/src/github.com-0a35038f75765ae4/datetime-0.2.1/src/lib.rs --crate-name datetime --crate-type lib -g -C metadata=f06f68585cec8716 -C extra-filename=-f06f68585cec8716 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern tz=/home/alanb/src/git/hub/exa/target/debug/deps/libtz-908fc5615f8315f2.rlib --extern regex=/home/alanb/src/git/hub/exa/target/debug/deps/libregex-32ebc1f1da8b6841.rlib --extern pad=/home/alanb/src/git/hub/exa/target/debug/deps/libpad-8b41ff1b2f475326.rlib --extern regex_macros=/home/alanb/src/git/hub/exa/target/debug/deps/libregex_macros-a3af5052cb03f830.so --extern num=/home/alanb/src/git/hub/exa/target/debug/deps/libnum-7ad397ad0b46ae38.rlib --extern locale=/home/alanb/src/git/hub/exa/target/debug/deps/liblocale-c1d2b96a2e42e568.rlib -Awarnings`
     Running `rustc /home/alanb/.cargo/git/checkouts/git2-rs-8b74d411676c498c/master/libgit2-sys/lib.rs --crate-name libgit2_sys --crate-type lib -g -C metadata=ee62f8ed694e2d9b -C extra-filename=-ee62f8ed694e2d9b --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern libz_sys=/home/alanb/src/git/hub/exa/target/debug/deps/liblibz_sys-78922e0e40333890.rlib --extern openssl_sys=/home/alanb/src/git/hub/exa/target/debug/deps/libopenssl_sys-f1940735b7e345d7.rlib --extern libssh2_sys=/home/alanb/src/git/hub/exa/target/debug/deps/liblibssh2_sys-197403f26ef746c2.rlib --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib -Awarnings -L native=/home/alanb/src/git/hub/exa/target/debug/build/libgit2-sys-ee62f8ed694e2d9b/out/lib -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -l rt -l static=git2 -l static=ssh2 -l ssl -l crypto -l dl -l z -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/out`
   Compiling git2 v0.2.13 (https://github.com/alexcrichton/git2-rs.git#889cf3dd)
     Running `rustc /home/alanb/.cargo/git/checkouts/git2-rs-8b74d411676c498c/master/src/lib.rs --crate-name git2 --crate-type lib -g -C metadata=2660a0a5365057d0 -C extra-filename=-2660a0a5365057d0 --out-dir /home/alanb/src/git/hub/exa/target/debug/deps --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern url=/home/alanb/src/git/hub/exa/target/debug/deps/liburl-a74304d08ea0134d.rlib --extern libgit2_sys=/home/alanb/src/git/hub/exa/target/debug/deps/liblibgit2_sys-ee62f8ed694e2d9b.rlib --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib --extern bitflags=/home/alanb/src/git/hub/exa/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib -Awarnings -L native=/home/alanb/src/git/hub/exa/target/debug/build/libgit2-sys-ee62f8ed694e2d9b/out/lib -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/out`
   Compiling exa v0.3.0 (file:///home/alanb/src/git/hub/exa)
     Running `rustc src/main.rs --crate-name exa --crate-type bin -g --cfg feature=\"git2\" --cfg feature=\"git\" --cfg feature=\"default\" --out-dir /home/alanb/src/git/hub/exa/target/debug --emit=dep-info,link -L dependency=/home/alanb/src/git/hub/exa/target/debug -L dependency=/home/alanb/src/git/hub/exa/target/debug/deps --extern datetime=/home/alanb/src/git/hub/exa/target/debug/deps/libdatetime-f06f68585cec8716.rlib --extern locale=/home/alanb/src/git/hub/exa/target/debug/deps/liblocale-c1d2b96a2e42e568.rlib --extern libc=/home/alanb/src/git/hub/exa/target/debug/deps/liblibc-ef5cbad4ef5c7a1e.rlib --extern threadpool=/home/alanb/src/git/hub/exa/target/debug/deps/libthreadpool-7afb0ed74cdfb4ee.rlib --extern git2=/home/alanb/src/git/hub/exa/target/debug/deps/libgit2-2660a0a5365057d0.rlib --extern natord=/home/alanb/src/git/hub/exa/target/debug/deps/libnatord-a05c856d0c2a4fbf.rlib --extern getopts=/home/alanb/src/git/hub/exa/target/debug/deps/libgetopts-1dade5d0522f070b.rlib --extern ansi_term=/home/alanb/src/git/hub/exa/target/debug/deps/libansi_term-099aa38433e28470.rlib --extern num_cpus=/home/alanb/src/git/hub/exa/target/debug/deps/libnum_cpus-16707c6acca9fe91.rlib --extern pad=/home/alanb/src/git/hub/exa/target/debug/deps/libpad-8b41ff1b2f475326.rlib --extern bitflags=/home/alanb/src/git/hub/exa/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib --extern number_prefix=/home/alanb/src/git/hub/exa/target/debug/deps/libnumber_prefix-790423cf7d755cf7.rlib --extern unicode_width=/home/alanb/src/git/hub/exa/target/debug/deps/libunicode_width-130fd712a1a101ee.rlib --extern users=/home/alanb/src/git/hub/exa/target/debug/deps/libusers-20f00ef534fe78a3.rlib --extern term_grid=/home/alanb/src/git/hub/exa/target/debug/deps/libterm_grid-94d230454780f24c.rlib -L native=/home/alanb/src/git/hub/exa/target/debug/build/libgit2-sys-ee62f8ed694e2d9b/out/lib -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/libssh2-sys-197403f26ef746c2/out/lib -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/home/alanb/src/git/hub/exa/target/debug/build/openssl-sys-f1940735b7e345d7/out`
src/feature/xattr_linux.rs:4:5: 4:22 warning: unused import, #[warn(unused_imports)] on by default
src/feature/xattr_linux.rs:4 use std::ffi::CString;
                                 ^~~~~~~~~~~~~~~~~

相同。 在带有 regex extern crate 的 macosx 上。

error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/expert_sys.0.o" "-o" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/expert_sys" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug" "-L" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps" "-L" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/libexpert_sys.rlib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps/libregex-97f2411d639fa5c9.rlib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps/libaho_corasick-32050201217e44e8.rlib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps/libmemchr-940d9877eaa7970c.rlib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps/liblibc-adb8b8e7aaa2f93f.rlib" "/nfs/zfs-student-3/users/gbersac/project/expert-system/target/debug/deps/libregex_syntax-695a6c2a2c33e892.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/libstd-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/libcollections-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/librand-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/liballoc-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/liblibc-17a8ccbd.rlib" "/nfs/zfs-student-3/users/gbersac/.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib/libcore-17a8ccbd.rlib" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-Wl,-rpath,@loader_path/../../../../.multirust/toolchains/nightly/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-l" "compiler-rt"
note: xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun

error: aborting due to previous error
Could not compile `expert_sys`.

在 macosx 上,有一个没有依赖关系的简单应用程序(https://github.com/yanns/rust-playground/tree/master/todo-list):

cargo run --target=x86_64-unknown-linux-musl
   Compiling todo-list v0.1.0 (file:///Users/yannsimon/projects/rust/rust-playground/todo-list)
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-nostdlib" "-static" "-Wl,--eh-frame-hdr" "-Wl,-(" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "/Users/yannsimon/projects/rust/rust-playground/todo-list/target/x86_64-unknown-linux-musl/debug/todo_list.0.o" "-o" "/Users/yannsimon/projects/rust/rust-playground/todo-list/target/x86_64-unknown-linux-musl/debug/todo_list" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/Users/yannsimon/projects/rust/rust-playground/todo-list/target/x86_64-unknown-linux-musl/debug" "-L" "/Users/yannsimon/projects/rust/rust-playground/todo-list/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcollections-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_unicode-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-d16b8f0e.rlib" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-d16b8f0e.rlib" "-l" "util" "-l" "compiler-rt" "/Users/yannsimon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)"
note: clang: warning: argument unused during compilation: '-nodefaultlibs'
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
error: Could not compile `todo-list`.

在 macosx 10.11.1 上使用最简单的应用程序:

> rustc --version
rustc 1.10.0 (cfcb716cf 2016-07-03)
> cargo --version
cargo 0.11.0-nightly (259324c 2016-05-20)
> rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
1.8.0-x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

mipsel-unknown-linux-gnu
mipsel-unknown-linux-musl
x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.10.0 (cfcb716cf 2016-07-03)
> cargo new hello --bin && cd hello
> cargo build --target=mipsel-unknown-linux-gnu
   Compiling hello v0.1.0 (file:///Users/Jon/Code/hello)
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib" "/Users/Jon/Code/hello/target/mipsel-unknown-linux-gnu/debug/hello.0.o" "-o" "/Users/Jon/Code/hello/target/mipsel-unknown-linux-gnu/debug/hello" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/Users/Jon/Code/hello/target/mipsel-unknown-linux-gnu/debug" "-L" "/Users/Jon/Code/hello/target/mipsel-unknown-linux-gnu/debug/deps" "-L" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/libstd-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/libcollections-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/libpanic_unwind-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/librustc_unicode-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/libunwind-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/librand-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/liballoc-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/liballoc_jemalloc-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/liblibc-e8edd0fd.rlib" "/Users/Jon/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/mipsel-unknown-linux-gnu/lib/libcore-e8edd0fd.rlib" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-l" "compiler-rt"
note: clang: warning: argument unused during compilation: '-pie'
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
error: Could not compile `hello`.

To learn more, run the command again with --verbose.

2年后,这种情况似乎还在发生? 🤔

2年后,这种情况似乎还在发生? +1

我在使用 Ubuntu 时遇到了同样的问题,可以使用 gcc-multilib 解决
sudo apt install gcc-multilib

@ivolvicente您的解决方案在 Ubuntu 16.04 LTS 上对我不起作用。 你可能有什么建议?

这种情况仍在发生,应该将其视为 Rust 错误。 我几天来一直试图解决这个问题,并在网上尝试了所有可能的答案,但都没有奏效。

OpenSSL 适用于我所有其他开发人员环境,因为它很重要。

我刚刚升级到 MacOS Mojave,无法让 Rust 正常工作、链接等。

怎么办?

curl -L https://git.io/rustlings | bash 导致它在 MacOS 上。

这种情况仍在发生,应该将其视为 Rust 错误。 我几天来一直试图解决这个问题,并在网上尝试了所有可能的答案,但都没有奏效。

OpenSSL 适用于我所有其他开发人员环境,因为它很重要。

我刚刚升级到 MacOS Mojave,无法让 Rust 正常工作、链接等。

怎么办?

升级到 Mojave 后我也遇到了这个问题

我认为这个问题应该打开,因为它仍在发生......

更新

就我而言,它已修复:

sudo chown -R $USER:$USER target
cargo clean
cargo run

我认为这个问题应该打开,因为它仍在发生......

更新

就我而言,它已修复:

sudo chown -R $USER:$USER target
cargo clean
cargo run

我有同样的问题,解决方案无法解决我的问题。
相关版本:

rustc 1.34.2 (6c2484dc3 2019-05-13)
cargo 1.34.0 (6789d8a0a 2019-04-01)

我建立了一个红豆杉的例子:

use yew::html;
use yew::prelude::*;

struct Model {
    value: i64,
}

enum Msg {
    DoIt,
}

impl Component for Model {
    type Message = Msg;
    type Properties = ();
    fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
        Self {
            value: 0,
        }
    }

    fn update(&mut self, msg: Self::Message) -> ShouldRender {
        match msg {
            Msg::DoIt => self.value = self.value + 1
        }
        true
    }
}

impl Renderable<Model> for Model {
    fn view(&self) -> Html<Self> {
        html! {
            <div>
               <button onclick=|_| Msg::DoIt,>{ "+1" }</button>
                <p>{ self.value }</p>
            </div>
        }
    }
}

fn main() {
    yew::initialize();
    App::<Model>::new().mount_to_body();
    yew::run_loop();
}

和紫杉版本:

[dependencies]
yew = "0.6"

输出是

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" ...............

我在 Amethyst 和 Rocket 中执行cargo test --all时遇到这个问题

当我尝试编译由amethyst new创建的项目时出现此错误。 底部它说
/usr/bin/ld: cannot find -lxcb-render /usr/bin/ld: cannot find -lxcb-shape /usr/bin/ld: cannot find -lxcb-xfixes

在“noria-server”上编译 Noria DB 时出现此错误

大家好,试试
须藤 xcode-select --reset

为我工作。

须藤 xcode-select --reset

解决了这个:

yum install postgresql-devel
cargo install diesel_cli --no-default-features --features postgres

@kentkrantz的提示

sudo dnf install postgresql-devel  #which installs libpq-devel actually

如果你使用苹果电脑,你可以试试这个命令安装工具链来解决这个问题"xcode-select --install",如果你使用 brew install Rust,请先卸载 Rust 然后再安装
Rust 官方安装指南~

https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a

运行命令:
xcode-select --install

如果这仍然不起作用:
xcode-select --reset

我收到了以下标签的相同错误(在本地目录的几次打印输出之后):

= note: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

运行命令: xcode-select --install做到了。

谢谢!

- E

大家好,试试
须藤 xcode-select --reset

为我工作。

多谢

我只是花了几个小时调试一些由于这个 xcode 不是最新的原因,再次。

任何人都想推荐一些喜欢的东西,强制xcode-select install在我每次启动计算机时或定期或...

如果您是 Mac 用户,请尝试以下命令进入终端,
xcode-select --install

我已经尝试过 Mac,现在我的 rust 开始使用它了.....

xcode-select --install

上面的修复可以正常工作......我已经将我的操作系统从 10.12 更新到 10.14(Catalina)并且我已经开始遇到上述问题,所以要解决上述问题,请在终端中使用上面的命令......

谢谢!

因为cargo install diesel_cli需要预先安装mysql/postgres/...
我只是安装 postgres,所以只需:

cargo install diesel_cli --no-default-features --features postgres

这种情况在 3+ 年后仍在发生

嗨,我尝试构建平价比特币并收到此错误。

他们说要做:

  • 货物建造 -p pbtc

但我只是

  • 货物建造

然后我得到这个错误。 为了解决我必须清理并做出正确的命令。

  • 货物清洁
  • 货物建造 -p pbtc

在 ubunutu 20 上遇到同样的错误。

我试过sudo apt install gcc-multilib但有用。

尝试cargo clean有效,但在每个cargo runbuild操作不是可行的解决方案,因为构建项目需要大约 25 分钟。

Finished dev [unoptimized + debuginfo] target(s) in 24m 45s

货运部:

[dependencies]
async-graphql = "1.12.2"
async-graphql-actix-web = "1.4.2"
actix-web = "2.0.0"
actix-rt = "1.0.0"

rustup check

stable-x86_64-unknown-linux-gnu - Up to date : 1.43.1 (8d69840ab 2020-05-04)

你好
对于 Mac 也有助于安装 gcc - brew install gcc
在我的情况下,重新安装 rustup 和xcode-select --installxcode-select --reset没有帮助

因为cargo install diesel_cli需要预先安装mysql/postgres/...
我只是安装 postgres,所以只需:

cargo install diesel_cli --no-default-features --features postgres

谢谢!

因为cargo install diesel_cli需要预先安装mysql/postgres/...
我只是安装 postgres,所以只需:

cargo install diesel_cli --no-default-features --features postgres

谢谢!

🌼✨🌱

这不是 Rust 或 Cargo 的错误(至少在我的特殊情况下)。 对我来说,这是关于安装 PostGres 开发工具来编译具有 Postgres 功能的diesel_cli。

问题是编译器(或货物)没有给出信息性错误消息。

就我的 Ubuntu 20 和 mysql 而言,我做了:

sudo apt-get install libmysqlclient-dev
cargo install diesel_cli --no-default-features --features mysql

我做到了。

=> Xcode-select --install
Xcode-select: error: command line tools are already installed, use "Software Update" to install updates

然后

=> sudo xcode-select -switch /Library/Developer/CommandLineTools

sudo xcodebuild -license在 MacOS 上为我工作。

对我来说(在 Ubuntu 上),引用 lstdc++ 很神奇。

RUSTFLAGS='-Clink-arg=-lstdc++' (或相应地更改配置)与货物命令一起传递会有所帮助。

Ubuntu 18 LTS
先加我--verbose
$ cargo build --verbose
之后我注意到(使用命令top )货物占用了所有可用资源,
所以在那之后我添加了--jobs 1
$ cargo build --release --verbose --jobs 1
然后我收到关于缺少 lib 的错误,
安装缺少的库后,它运行没有任何问题

这种情况在 3+ 年后仍在发生

看到 rust 背后的开发人员在 3 年多之后没有解决这个问题,这很烦人。

@porplax

看到 rust 背后的开发人员在 3 年多之后没有解决这个问题,这很烦人。

考虑到该问题已关闭 5 年以上,这并不奇怪。

如果您有类似的问题(并且“与cc失败”可能出于多种原因出现),请重新创建一个新问题。

就我而言,这是由于 OpenSSL

sudo apt-get -y install gcc-multilib pkg-config libssl-dev
cargo clean
cargo run

在 ubuntu 20.04 上也有这个问题。

我在 Ubuntu 20.04 上,执行时遇到了同样的错误:

cargo install diesel_cli --no-default-features --features postgres

所以,我按照说明安装了 postgres,然后我做了:

sudo apt-get install libpq-dev

它解决了我的问题。

我能够通过安装libxcb-shape0-dev来修复它。 看起来这与图书馆问题有关。 一个更好的错误信息会很好。

我在 Ubuntu 20.04 上,执行时遇到了同样的错误:

cargo install diesel_cli --no-default-features --features postgres

所以,我按照说明安装了 postgres,然后我做了:

sudo apt-get install libpq-dev

它解决了我的问题。

非常感谢你!

我在 Manjaro 上,在执行这个命令时遇到了这个问题:
cargo install diesel_cli --no-default-features --features "postgres"
但是安装postgresql 包修复了它:
sudo pacman -S postgresql

我在 Mac Catalina 10.15 上尝试所有解决方案,有效的解决方案是:

sudo xcode-select --reset
cargo clean
cargo build
此页面是否有帮助?
0 / 5 - 0 等级

相关问题

Mark-Simulacrum picture Mark-Simulacrum  ·  681评论

nikomatsakis picture nikomatsakis  ·  274评论

cramertj picture cramertj  ·  512评论

aturon picture aturon  ·  417评论

alexcrichton picture alexcrichton  ·  240评论