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= 

where  is one or many of:
  VC=<6,7,8,9,10,11,12,14>     - VC versions
  WITH_DEVEL=            - 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=     - Enable OpenSSL support, DLL or static
  WITH_CARES=   - Enable c-ares support, DLL or static
  WITH_ZLIB=    - Enable zlib support, DLL or static
  WITH_SSH2=    - Enable libSSH2 support, DLL or static
  ENABLE_SSPI=      - Enable SSPI support, defaults to yes
  ENABLE_IPV6=      - Enable IPv6, defaults to yes
  ENABLE_IDN=       - 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=    - Enable native Windows SSL support, defaults to yes
  GEN_PDB=          - Generate Program Database (debug symbols for release build)
  DEBUG=            - Debug builds
  MACHINE=         - 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.




你可能感兴趣的:(HTTP)