首页 三方库编译系列3:libcurl
文章
取消

三方库编译系列3:libcurl

libz要用zlib压缩包编译

依赖libz,openssl

intel编译选项

./configure –prefix=/Users/xx/build/curl –with-ssl=/Users/xx/OpenSSL/mac –with-zlib=/Users/xx/libz/mac –disable-static

有可能需要修改openssl的pc文件中路径 ca cert bundle: /etc/ssl/cert.pem SSL: enabled (OpenSSL) zlib: enabled IPv6: enabled Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP

arm64 for mac ./configure –prefix=/Users/xx/build –with-ssl=/Users/xx/OpenSSL/arm64 –with-zlib=/Users/xx/libz/arm64 –disable-static

win 上编译 winbuild目录下 nmake /f Makefile.vc mode=dll ZLIB_PATH=D:\libz\win SSL_PATH=D:\OpenSSL\win ENABLE_WINSSL=no WITH_SSL=dll WITH_ZLIB=dll MACHINE=x64 重命名libcurl.lib为curl.lib

win curl https如果请求失败: 在https://curl.se/docs/caextract.html 下载cacert.pem Some programs will expect this file to be named ca-bundle.crt (in the correct path). curl on windows has a system to find it if named curl-ca-bundle.crt. Rename the cacert.pem file into curl-ca-bundle.crt

nmake /f Makefile.vc mode=dll ZLIB_PATH=D:\libz\win SSL_PATH=D:\OpenSSL\win ENABLE_WINSSL=no WITH_SSL=dll WITH_ZLIB=dll MACHINE=x64 ENABLE_UNICODE=yes GEN_PDB=yes ENABLE_IDN=no

debug版本 nmake /f Makefile.vc mode=dll ZLIB_PATH=D:\libz\win SSL_PATH=D:\OpenSSL\win ENABLE_WINSSL=no WITH_SSL=dll WITH_ZLIB=dll MACHINE=x64 ENABLE_UNICODE=yes GEN_PDB=yes DEBUG=yes

//#define USE_SOCKETPAIR 1

arm windows版本 cmake -G”Visual Studio 17 2022” -A ARM64 -DCURL_ZLIB=ON -DCMAKE_USE_OPENSSL=ON -DCMAKE_INSTALL_PREFIX=”C:\devel\compile\build\curl” -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=”C:\devel\compile\build\openssl;C:\devel\compile\build\libz” 有输出: Enabled SSL backends: OpenSSL Enabled protocols:里面有 HTTPS 打开CURL.sln后对左侧的Install执行all rebuild

本文由作者按照 CC BY 4.0 进行授权