Linux编译带SSL/TLS的LibCurl

484 词

当想要用libcurl去请求https资源的时候,就需要带SSL的libcurl

首先静态编译openssl

1
2
3
4
5
apt install git -y
git clone https://github.com/openssl/openssl
cd openssl
./config -fPIC no-shared --prefix=/usr/local no-dso no-ssl3
make && make install

接着静态编译链接了openssl的libcurl

1
2
3
4
5
6
apt install wget unzip -y
wget https://curl.se/download/curl-7.84.0.zip
unzip curl-7.84.0.zip
cd curl-7.84.0
./configure --prefix=/usr/local --with-ssl=/usr/local --disable-shared
make && make install

搞定收工!

libcurl的静态链接库在目录/usr/local/lib下的libcurl.a

Linux编译带SSL/TLS的LibCurl

http://example.com/post/libcurl-tls/
Author

lingxh

Published at

2022-08-23

License

CC BY-NC-SA 4.0

留言