libcurl linux 静态链接库_静态编译curl 和 可选静态编译依赖库

本文介绍了如何手动编译安装libcurl以支持更细致的时间粒度和HTTP2,并详细说明了如何静态链接openssl 1.1.1b和nghttp2库。通过配置不同的编译选项,可以创建不依赖openssl和nghttp2动态链接库的curl版本。同时,文章还解决了编译过程中可能出现的问题,包括找不到依赖库、动态链接库缺失等,并给出了使用新库编译example例子的方法。
摘要由CSDN通过智能技术生成

新版的curl 支持了更细致时间粒度的curl_easy_getinfo,以及HTTP2, 这里介绍手工编译源码安装方式,并使用openssl1.1.1b

从https://www.openssl.org/ 下载1.1.1 序列的long-term 源码,并编译安装 ./config --prefix=/opt/itc/openssl enable-weak-ssl-ciphers no-shared && make && make install

从https://nghttp2.org/ 下载nghttp2库, curl 需要它才能支持HTTP2,编译安装, OPENSSL_LIBS="/opt/itc/openssl/lib/" ./configure --prefix=/opt/itc/curl/nghttp2–enable-static=yes –enable-shared=no && make && make install

从https://curl.haxx.se/ 下载最新的curl版本,并编译安装,编译参数如下

./configure LDFLAGS="-static" --prefix=/opt/itc/curl --with-ssl=/opt/itc/openssl --with-nghttp2=/opt/itc/curl/nghttp2 --disable-ldaps --without-libidn2 --enable-static=yes --enable-shared=no

make

make install

这样子得到的是不依赖openssl和nghttp2动态链接库的curl,可以拷走给别的机器

./configure LDFLAGS="-static" --prefix=/opt/itc/curl --wi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值