我方便的小 rust 二进制文件在编译并在几乎每个系统上运行时都工作得很好,除了我需要它运行的 Ubuntu 18.04 之外。你可能会问为什么?
error while loading shared libraries: libcrypto.so.10: cannot open shared object file: No such file or directory
就其值(value)而言,我确信它之前曾提示过 libssl.so.10 - 不确定我做了什么来让它消失。
无论如何,我认为传统的解决方法是更新 libssl - 由于我不会费心进入这里,在这种情况下我不能这样做。我还尝试过符号链接(symbolic link) libcrypto.so.1.0.0 - 这只会导致有关缺少版本的投诉。
所以,我希望有一种方法可以将此依赖项捆绑到二进制文件中,而不是依赖它在运行时系统上可用。我完全不知道该怎么做;有人可以建议吗?
[dependencies]
async-trait = "0.1.48"
clap = "3.0.0-beta.2"
futures = "0.3"
rusoto_credential = "0.46.0"
rusoto_core = { version="0.46.0" }
rusoto_lambda = "0.46.0"
rusoto_sts = "0.46.0"
serde = "0.9"
serde_json = "0.9"
serde_derive = "0.9"
tokio = { version = "1", features = ["full"] }
最佳答案
只需将以下内容添加到您的依赖项中:
openssl = { version = "0.10", features = ["vendored"] }
瞧:
$ ldd target/debug/ssltest
linux-vdso.so.1 (0x00007fffa538c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7ab1a67000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7ab1a44000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7ab1a3e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7ab184c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7ab2a07000)
参见openssl crate documentation .
If the
vendored
Cargo feature is enabled, theopenssl-src
crate will be used to compile and statically link to a copy of OpenSSL.
关于rust - 如何避免对 libssl.so.10 和 libcrypto.so.10 的依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66585798/