linux编译openssl报错,cargo编译musl报错openssl

在生产环境和编译环境glibc版本不一致导致报错后,尝试使用cargo跨平台编译x86_64-unknown-linux-musl遇到了openssl相关错误。错误提示表明找不到openssl的安装目录。解决方案包括为Ubuntu/Debian安装libssl-dev,为CentOS/Fedora安装openssl-devel,而在Arch/Manjaro中,需设置环境变量OPENSSL_DIR为/usr。通过查找libssl.so文件路径确认OPENSSL_DIR值。
摘要由CSDN通过智能技术生成

cargo编译musl报错openssl

背景

生产环境和编译环境的glibc版本不同出现来如下报错

/lib64/libc.so.6: version `GLIBC_x.xx' not found

所以需要使用cargo 跨平台编译x86_64-unknown-linux-musl,而后就报出来openssl相关的错误:

--- stderr

thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot

proceed without this knowledge. If OpenSSL is installed and this crate had

trouble finding it, you can set the `OPENSSL_DIR` environment variable for the

compilation process.

Make sure you also have the development packages of openssl installed.

For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found

automatically, please open a bug at https://github.com/sfackler/rust-openssl

and include infor

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值