一、环境
系统:centos7.4
libcurl版本:curl-7.63.0.tar.gz
openssl版本:openssl-1.1.1.tar.gz
二、编译openssl
./configure --prefix=/usr/local/openssl shared zlib
shared 表示生成动态库
zlib 压缩解压缩库
三、添加环境变量
vi /etc/profile
添加:
export PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig
然后:
source /etc/profile
四、编译libcurl
./configure --prefix=/usr/local/libcurl --with-ssl
make
make install
五、C++调用增加两句话
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);//设定为不验证证书和HOST
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);