无法编译 Rust 项目,使用 `cc` 连接失败。

8

我fork了一个仓库并对其进行了一些修改。这个crate可以单独编译,所有的测试都通过了。但是,当我尝试在另一个项目中使用它时,无法将其构建。该包位于https://github.com/tvallotton/cryptomkt-rs。当我尝试构建时,出现以下错误:

error: linking with `cc` failed: exit code: 1
 note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/tomas/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.12eopxe64jiga9cl.rcgu.o" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.13pxyuns9c1d6kzp.rcgu.o" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.17f6urnch4d3l1qf.rcgu.o" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.186s2n3wf04nvd1r.rcgu.o" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.19oknpphhzw1pwaw.rcgu.o" "/Users/tomas/Documents/Robot/target/debug/deps/cryptomkt.1d717sag2z2itfn.rcgu.o" ...

直到它显示以下信息,才意味着它一直在列出大量的文件:

note: Undefined symbols for architecture x86_64:
            "_$LT$hyper..client..pool..IdleTask$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::CALLSITE::h8562117401c9862b", referenced from:
                _$LT$hyper..client..pool..IdleTask$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::hcf81650553e4b8d7 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::IdlePopper$LT$T$GT$::pop::CALLSITE::hdb8821434cc4049c", referenced from:
                hyper::client::pool::IdlePopper$LT$T$GT$::pop::h0184b89e061331ca in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::PoolInner$LT$T$GT$::put::CALLSITE::h7a860d368ff7fc0e", referenced from:
                hyper::client::pool::PoolInner$LT$T$GT$::put::h3bf1fbbcb5b5c2a0 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::PoolInner$LT$T$GT$::put::CALLSITE::h509cef2de2cc89f8", referenced from:
                hyper::client::pool::PoolInner$LT$T$GT$::put::h3bf1fbbcb5b5c2a0 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::PoolInner$LT$T$GT$::put::CALLSITE::h2cfd4e6291083074", referenced from:
                hyper::client::pool::PoolInner$LT$T$GT$::put::h3bf1fbbcb5b5c2a0 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::PoolInner$LT$T$GT$::clear_expired::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::CALLSITE::h13726d305adbfffb", referenced from:
                hyper::client::pool::PoolInner$LT$T$GT$::clear_expired::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h27246c2417d1b1e0 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::Checkout$LT$T$GT$::checkout::_$u7b$$u7b$closure$u7d$$u7d$::CALLSITE::h32a50446d02ecbd7", referenced from:
                hyper::client::pool::Checkout$LT$T$GT$::checkout::_$u7b$$u7b$closure$u7d$$u7d$::haf913c9cab223bb4 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::client::pool::Expiration::new::h8a80e1576f6eec24", referenced from:
                hyper::client::pool::Checkout$LT$T$GT$::checkout::h1dbf8e1ad5d03d80 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::proto::h2::client::new_builder::h84aa3dd1fa3ca46c", referenced from:
                hyper::proto::h2::client::handshake::_$u7b$$u7b$closure$u7d$$u7d$::h58ec8a0645a1f8b7 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.4.rcgu.o)
            "hyper::client::pool::Checkout$LT$T$GT$::checkout::CALLSITE::hdfc0977a3a477501", referenced from:
                hyper::client::pool::Checkout$LT$T$GT$::checkout::h1dbf8e1ad5d03d80 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "hyper::proto::h1::io::Buffered$LT$T$C$B$GT$::parse::CALLSITE::h80ae9da06eb890a4", referenced from:
                hyper::proto::h1::io::Buffered$LT$T$C$B$GT$::parse::h0f85580a3cedc9a9 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.10.rcgu.o)
            "hyper::error::Error::new::h268934c19642662e", referenced from:
                hyper::error::Error::new_connect::h56975191e5f950f5 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
                hyper::error::Error::new_body_write::h939273b3a84d6a0c in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
                hyper::error::Error::new_body_write::hb520effbc68563b7 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
                hyper::error::Error::new_body_write::hd3366263e713e333 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
                hyper::error::Error::new_body::hb62af6c235b8fe52 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "_$LT$hyper..proto..h1..decode..IncompleteBody$u20$as$u20$core..fmt..Display$GT$::fmt::h1f1558507704aa39", referenced from:
                l___unnamed_22 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.8.rcgu.o)
            "alloc::boxed::Box$LT$T$C$A$GT$::into_raw_with_allocator::h3fdf8db2917905f5", referenced from:
                alloc::boxed::Box$LT$dyn$u20$core..any..Any$C$A$GT$::downcast::h08aec53f8b4f8277 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.8.rcgu.o)
            "core::option::Option$LT$T$GT$::is_some::h266686d036341852", referenced from:
                core::option::Option$LT$T$GT$::is_none::h68b1b40502f071c3 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.8.rcgu.o)
                reqwest::proxy::Proxy::maybe_has_http_auth::h508f30b8d3e3fe88 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.9.rcgu.o)
            "_$LT$hyper..client..connect..dns..GaiAddrs$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::h4d05358572e4896a", referenced from:
                _$LT$core..iter..adapters..map..Map$LT$I$C$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::next::hf37d25ee1a949c68 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.7.rcgu.o)
            
                             ...

                _$LT$hyper..client..connect..http..HttpConnector$LT$R$GT$$u20$as$u20$tower_service..Service$LT$http..uri..Uri$GT$$GT$::poll_ready::h9c4f8b58095a8451 in libreqwest-a4e6bec7f863a529.rlib(reqwest-a4e6bec7f863a529.reqwest.1hhxvzw4-cgu.11.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


我尝试使用 softwareupdate --install --all 来更新xcode。同时,我还使用 xcode-select --install 重新安装了它。我使用搭载M1芯片的MacBook Air。

在 Cargo.toml 文件中,我有以下内容:

[dependencies.cryptomkt]
version = "0.3.0"
git = "https://github.com/tvallotton/cryptomkt-rs"

我非常希望能得到一些帮助。谢谢。


1
这是一个非常有趣的问题。我已经成功地重现了您的问题,但是在使用cryptomkt-rs版本时,您的版本从中分叉时并没有出现该问题。这两个版本之间的关键区别似乎是使用了tokio。我建议在cargo存储库中提交一个问题。这非常奇怪。 - umgefahren
我想我会的,谢谢。 - Tomás Vallotton
1
在这个问题中,有人实际上找到了解决方案。如果有人遇到类似的问题,这是链接 https://github.com/rust-lang/cargo/issues/9251。 - Tomás Vallotton
1个回答

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接