gpt4 book ai didi

linux - 使用 Cargo 构建 openssl crate 的问题

转载 作者:太空宇宙 更新时间:2023-11-04 09:11:59 24 4
gpt4 key购买 nike

每当我尝试编译我得到

  = note: /usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libnative_tls-e4af7be01e0cc1c7.rlib(native_tls-e4af7be01e0cc1c7.native_tls.c3tq55qu-cgu.0.rcgu.o): in function `<openssl::stack::StackRef<T>>::len':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/stack.rs:171: undefined reference to `sk_num'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libnative_tls-e4af7be01e0cc1c7.rlib(native_tls-e4af7be01e0cc1c7.native_tls.c3tq55qu-cgu.0.rcgu.o): in function `<openssl::stack::StackRef<T>>::_get':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/stack.rs:242: undefined reference to `sk_value'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.11.rcgu.o): in function `openssl::ssl::compat::tls_method':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:2546: undefined reference to `SSLv23_method'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.15.rcgu.o): in function `<openssl::stack::Stack<T>>::new':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/stack.rs:40: undefined reference to `sk_new_null'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.15.rcgu.o): in function `<openssl::stack::Stack<T> as core::ops::drop::Drop>::drop':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/stack.rs:50: undefined reference to `sk_free'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.15.rcgu.o): in function `<openssl::stack::StackRef<T>>::pop':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/stack.rs:232: undefined reference to `sk_pop'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.4.rcgu.o): in function `openssl::version::number':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/version.rs:51: undefined reference to `SSLeay'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl-a51d9ef9dbb88c83.rlib(openssl-a51d9ef9dbb88c83.openssl.27r2wowg-cgu.6.rcgu.o): in function `openssl::x509::compat::X509_up_ref':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/x509/mod.rs:1172: undefined reference to `CRYPTO_add_lock'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl_sys-51d0c50f2e67767f.rlib(openssl_sys-51d0c50f2e67767f.openssl_sys.afwyjyem-cgu.9.rcgu.o): in function `openssl_sys::init::{{closure}}':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:150: undefined reference to `SSL_library_init'
/usr/bin/ld: /home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:151: undefined reference to `SSL_load_error_strings'
/usr/bin/ld: /home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:152: undefined reference to `OPENSSL_add_all_algorithms_noconf'
/usr/bin/ld: /home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:154: undefined reference to `CRYPTO_num_locks'
/usr/bin/ld: /home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:164: undefined reference to `CRYPTO_set_locking_callback'
/usr/bin/ld: /home/trent/Documents/projects/coding/rust/website/auth/target/debug/deps/libopenssl_sys-51d0c50f2e67767f.rlib(openssl_sys-51d0c50f2e67767f.openssl_sys.afwyjyem-cgu.9.rcgu.o): in function `openssl_sys::init::set_id_callback':
/home/trent/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/src/lib.rs:139: undefined reference to `CRYPTO_set_id_callback'
collect2: error: ld returned 1 exit status

Complete log

我同时安装了 OpenSSL 和 OpenSSL-1.0。我尝试同时使用 Rust stable 和 nightly。我还尝试包含不同版本的 openssl crate,但我认为 Cargo 只是在构建我认为 grpc 正在使用的 crate 版本。我在使用 Arch Linux。

最佳答案

您的项目正在使用 openssl 0.9.x(可能通过 tls-api-native-tls 0.1.x -> native-tls 0.1.x -> openssl 0.9.x),不支持 OpenSSL 1.1.1。我也在使用 Arch Linux,我必须将我的程序更新到 openssl 0.10 才能使用 OpenSSL 1.1.1。

在您的情况下,tls-api-native-tls 需要更新以依赖于 native-tls 0.2.x,它使用 openssl 0.10。 x(支持 OpenSSL 1.1.1)。 There is an open issue about this.

如果这太复杂,您还可以使用各种环境变量来告诉 openssl-sys 的构建脚本您要使用哪个 OpenSSL 安装。如果您更喜欢使用 OpenSSL 1.0.x,请在您的 shell 中输入以下命令:

$ cargo clean
$ OPENSSL_INCLUDE_DIR=/usr/include/openssl-1.0 OPENSSL_LIB_DIR=/usr/lib/openssl-1.0 cargo build

(注意:以上路径可能特定于 Arch Linux。)

有关可用于配置 openssl-sys 的环境变量的更多信息,请参阅 Manual configuration .

关于linux - 使用 Cargo 构建 openssl crate 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54407841/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com