libcurl 编译指南(支持SSL)

      首先,从libcurl官网下载源码:https://curl.haxx.se/download.html,我下载的是curl-7.48.0版本。其次,确认已经安装了VS2008或者其他版本的Visual Studio。

        由于之前使用VS编译的libcurl库不支持SSL,这次改用nmake来编译。经过测试,nmake编译出来的库是支持SSL的。至于VS编译出来的为什么不行(配置了预处理也不行),暂时无从知晓。下面就介绍如何使用nmake来编译出支持SSL的静态库:

        打开 Visual Studio 2008命令提示,cd 到 curl-7.48.0下的winbuild目录,然后按照winbuild目录下BUILD.WINDOWS.txt文件的说明,输入:nmake /f makefile.vc mode=static VC=9 ENABLE_IDN=no debug=no,然后回车开始编译!值得注意一下:最好指定VC的版本号(VS2008的VC版本是9.0),否则外部程序编译时,可能会出现“无法解析的外部符号”的提示错误。待编译完成后,在 curl-7.48.0\builds\libcurl-vc7-x86-release-static-ipv6-sspi-winssl 目录下,就是刚才编译好的lib库了。


======================== 编译选项 ===========================

Then you can call nmake /f Makefile.vc with the desired options (see below).  
The builds will be in the top src directory, builds\ directory, in   
a directory named using the options given to the nmake call.  
  
nmake /f Makefile.vc mode=<static or dll> <options>  
  
where <options> is one or many of:  
  VC=<6,7,8,9,10,11,12,14>     - VC versions  
  WITH_DEVEL=<path>            - Paths for the development files (SSL, zlib, etc.)  
                                 Defaults to sibbling directory deps: ../deps  
                                 Libraries can be fetched at http://windows.php.net/downloads/php-sdk/deps/  
                                 Uncompress them into the deps folder.  
  WITH_SSL=<dll or static>     - Enable OpenSSL support, DLL or static  
  WITH_CARES=<dll or static>   - Enable c-ares support, DLL or static  
  WITH_ZLIB=<dll or static>    - Enable zlib support, DLL or static  
  WITH_SSH2=<dll or static>    - Enable libSSH2 support, DLL or static  
  ENABLE_SSPI=<yes or no>      - Enable SSPI support, defaults to yes  
  ENABLE_IPV6=<yes or no>      - Enable IPv6, defaults to yes  
  ENABLE_IDN=<yes or no>       - Enable use of Windows IDN APIs, defaults to yes  
                                 Requires Windows Vista or later, or installation from:  
                                 https://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815  
  ENABLE_WINSSL=<yes or no>    - Enable native Windows SSL support, defaults to yes  
  GEN_PDB=<yes or no>          - Generate Program Database (debug symbols for release build)  
  DEBUG=<yes or no>            - Debug builds  
  MACHINE=<x86 or x64>         - Target architecture (default is x86)  
  
Static linking of Microsoft's C RunTime (CRT):  
==============================================  
If you are using mode=static nmake will create and link to the static build of  
libcurl but *not* the static CRT. If you must you can force nmake to link in  
the static CRT by passing RTLIBCFG=static. Typically you shouldn't use that  
option, and nmake will default to the DLL CRT. RTLIBCFG is rarely used and  
therefore rarely tested. When passing RTLIBCFG for a configuration that was  
already built but not with that option, or if the option was specified  
differently, you must destroy the build directory containing the configuration  
so that nmake can build it from scratch.  
  
Legacy Windows and SSL  
======================  
When you build curl using the build files in this directory the default SSL  
backend will be WinSSL (Windows SSPI, more specifically Schannel), the native  
SSL library that comes with the Windows OS. WinSSL in Windows <= XP is not able  
to connect to servers that no longer support the legacy handshakes and  
algorithms used by those versions. If you will be using curl in one of those  
earlier versions of Windows you should choose another SSL backend like OpenSSL.  


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值