Saturday, June 22, 2013

How to build cURL static library with SSL support on Windows

This is a short note about building cURL with SSL support on Windows.

Tools required:
  1. cURL source: Download latest cURL source from here.
  2. Microsoft Visual C++ 2008 or 2010 Express Edition: It looks like 2008 Express Edition is no longer available, but 2010 Express Edition can be downloaded from here.
  3. Win32 OpenSSL:
    1. Download Win32 OpenSSL installer and Visual Studio redistributable from here - these are Win32 OpenSSL v1.0.1e and Visual C++ 2008 Redistributables at the time of this writing.
    2. Install Win32 OpenSSL; by default it installs to C:\OpenSSL-Win32.
    3. Install Visual C++ 2008 redistributable.

Building cURL:
  1. Run Visual Studio 2008 Command Prompt from Start Menu > All Programs > Microsoft Visual C++ 2008 Express Edition > Visual Studio Tools. Or, Visual Studio 2010 Command Prompt if you're using Visual C++ 2010.
  2. Navigate to winbuild sub-directory in cURL source directory, and issue following command:
nmake /f Makefile.vc mode=static WITH_SSL=static WITH_DEVEL=C:\OpenSSL-Win32 VC=X ENABLE_SSPI=no ENABLE_IDN=no ENABLE_WINSSL=no DEBUG=no MACHINE=x86 GEN_PDB=no ENABLE_IPV6=yes

Note: In VC=X, replace X with 9 for Visual C++ 2008 or 10 for Visual C++ 2010.

Once build is complete, cURL static libraries would be copied to builds sub-directory in cURL source directory.