交叉编译后缺少共享库的替代解决方案?
问题说明
我首先交叉编译Rust项目到linux target
I first cross compile my Rust project to linux target
cargo build --target x86_64-unknown-linux-gnu
然后在本地ubuntu上运行 ldd
,并且链接器工作正常.
Then run ldd
on my local ubuntu and the linker works fine.
linux-vdso.so.1 (0x00007fffddc62000)
libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f6d34500000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f6d340b0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6d33ea0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6d33c90000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6d33a70000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6d33850000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6d33440000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6d35a00000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6d330a0000)
但是在我的目标操作系统上, ldd
无法找到库
But on my target os, ldd
fails to find the libraries
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
/lib64/libc.so.6 => version `GLIBC_2.18' not found
实际上,我在 LD_LIBRARY_PATH
下安装了 libssl.so.10
和 libcrypto.so.10
.不幸的是,我无法安装Rust所需的版本为 1.0.0
的共享库.
Actually I have libssl.so.10
and libcrypto.so.10
installed under LD_LIBRARY_PATH
. Unfortunately I am not able to install shared libraries of version 1.0.0
required by Rust.
我已阅读 Rust Cross ,建议的解决方案是安装缺少的共享库.不幸的是,这对我来说是不可能的.因此,我正在寻找丢失的库的替代解决方案.
I have read Rust Cross and the recommended solution is to install the missing shared libraries. Unfortunately that's not possible for me. So I am looking for alternative solutions to missing libraries.
libssl.so.1.0.0
和 libcrypto.so.1.0.0
听起来很古老.如何告知 cargo
使用更高版本?
libssl.so.1.0.0
and libcrypto.so.1.0.0
sound ancient. How can I tell cargo
to use a later version?
我该如何处理/lib64/libc.so.6 =>找不到版本GLIBC_2.18
?
正确答案
根据此, GLIBC_2.18
无法安装到 RHEL7
.我放弃了动态链接的库.
According to this, GLIBC_2.18
can't be installed to RHEL7
. I gave up dynamically linked libraries.
此帖子帮助了我.解决方案是:
This post helped me out. The solution is:
[dependencies]
nats = "*"
protobuf = { version = "~2.0" }
# Add openssl-sys as a direct dependency so it can be cross compiled to
# x86_64-unknown-linux-musl using the "vendored" feature below
openssl-sys = "*"
[features]
# Force openssl-sys to staticly link in the openssl library. Necessary when
# cross compiling to x86_64-unknown-linux-musl.
vendored = ["openssl-sys/vendored"]
这样,我可以使用以下方法将其编译为没有库依赖性的单个可执行文件:
This way I can compile to a single executable with no library dependencies using:
cargo build --target=x86_64-unknown-linux-musl --features vendored
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfhggg
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20