在 Arch 下编译 OpenWRT cmcurl 问题与解决方案

在Arch Linux环境下编译OpenWRT 15.05时遇到cmcurl报错,通过安装并链接旧版OpenSSL解决。该文详细记录了解决过程。

0 现象

在 Arch 下编译 OpenWRT (15.05) cmcurl 时报错:

[ 28%] Linking C executable LIBCURL
lib/libcmcurl.a(openssl.c.o): In function `cert_stuff`:
openssl.c:(.text+0x97a): undefined reference to `sk_num`
openssl.c:(.text+0x99a): undefined reference to `sk_pop`
openssl.c:(.text+0xa21): undefined reference to `sk_num`
openssl.c:(.text+0xa62): undefined reference to `sk_pop_free`
lib/libcmcurl.a(openssl.c.o): In function `Curl_ossl_init`:
openssl.c:(.text+0xf74): undefined reference to `SSL_load_error_strings`
openssl.c:(.text+0xf79): undefined reference to `SSL_library_init`
openssl.c:(.text+0xf89): undefined reference to `OPENSSL_add_all_algorithms_noconf`
lib/libcmcurl.a(openssl.c.o): In function `Curl_ossl_cleanup`:
openssl.c:(.text+0xfad): undefined reference to `EVP_cleanup`
openssl.c:(.text+0xfb2): undefined reference to `ERR_free_strings`
lib/libcmcurl.a(openssl.c.o): In function `verifyhost`:
openssl.c:(.text+0x1a7a): undefined reference to `sk_num`
openssl.c:(.text+0x1a9a): undefined reference to `sk_value`
lib/libcmcurl.a(openssl.c.o): In function `ossl_connect_step1`:
openssl.c:(.text+0x29a5): undefined reference to `SSLv23_client_method`
lib/libcmcurl.a(openssl.c.o): In function `X509V3_ext`:
openssl.c:(.text+0x3a77): undefined reference to `sk_num`
openssl.c:(.text+0x3aab): undefined reference to `sk_value`
openssl.c:(.text+0x3d5c): undefined reference to `sk_num`
lib/libcmcurl.a(openssl.c.o): In function `get_cert_chain`:
openssl.c:(.text+0x3fe2): undefined reference to `sk_num`
openssl.c:(.text+0x4061): undefined reference to `sk_value`
lib/libcmcurl.a(openssl.c.o): In function `Curl_ossl_version`:
openssl.c:(.text+0x61c3): undefined reference to `SSLeay`
collect2: error: ld returned 1 exit status

看得出来应该是相关库未链接成功。

1 解决方案

查阅了相关文档,发现这些方法是在老的 OpenSSL 中存在的,首先先安装老版本:

$ sudo pacman -S openssl-1.0

使用软链接的方式,更改默认库的指向使用老版本即可(若已有软链接,需要先删除),如:

# rm libcrypto.so
# rm libssl.so
# ln -s libcrypto.so.1.0.0 libcrypto.so
# ln -s libssl.so.1.0.0 libssl.so

 

转载于:https://www.cnblogs.com/sigeryoung/p/arch-compiling-openwrt-openssl-issue.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值