Linux静态编译OpenSSL与libcurl

一、背景

某个工程中需要使用libcurl访问https网站,为了可移植性,需要将libcurl编译成静态的。由于访问的是https开头的网站,所以还需加入对OpenSSL的编译,同样使用编译。

二、静态编译OpenSSL

1、下载OpenSSL源码:

git clone https://github.com/openssl/openssl.git
git checkout -b OpenSSL_1_0_0-stable origin/OpenSSL_1_0_0-stable   //分支自己按需选取
git pull

2、./config --prefix=/path/to/openssl -fPIC no-shared no-dso no-ssl3    //--prefix指定安装路径

3、make depend

4、make

5、make install

三、静态编译libcurl

1、下载源码包:

https://curl.haxx.se/download/curl-7.29.0.tar.gz(按需选择包版本:https://curl.haxx.se/download/),进入源码目录。

2、./configure --prefix=/path/to/curl --disable-shared --enable-static --with-ssl=/path/to/openssl --without-libidn --without-librtmp  --without-nss --without-libssh2 --without-zlib --without-winidn --without-gnutls --disable-rtsp  --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值