cURL / Mailing Lists / curl-library / Single Mail


Re: Compiling libcurl for https

From: Ray Satiro via curl-library <>
Date: Wed, 21 Oct 2015 03:30:00 -0400

On 10/20/2015 9:08 PM, Andrew Williams wrote:
> Folks,
> First post and a novice developer although I have spent the best part
> of 25 years hacking at various languages.
> I'm using VS Community 2015 as an IDE.
> I'm trying to evaluate libcurl as a library for use in another desktop
> application.
> I managed to get some example code working after compiling libcurl. I
> got all those symbol errors if I just tried to use the pre-compiled
> libcurl.dll.
> The application even worked for HTTP source images.
> When I tried it with the target URL with HTTPS it failed.
> I did a curl.exe -V and https isn't listed as a supported source
> although I'm not sure it supposed to. In some systems http implies https.
> So my code works for HTTP but here it is just to make sure.
> My question is do I need to do anything special to get libcurl to
> support https or is there something else in the code that's missing?

You'll need to build libcurl with SSL support. There are quite a number
of combinations to do that for Visual Studio. You can choose from 3
different build methods and you can choose from multiple SSL libraries.
You can use the SSL support built in to Windows, or you can use OpenSSL
or wolfSSL. Note that wolfSSL is GPL licensed. It may be possible to use
other SSL libraries. OpenSSL is by far the most popular so I'd guess it
has more bugs worked out than WinSSL.

The three ways are winbuild directory (see BUILD.WINDOWS.txt in that
dir), projects directory (see README in that dir) or cmake (see
docs/INSTALL.cmake). I'm familiar with the first two but not with cmake.

Here is an example from the first way. For example your platform is x86
and you're using VS2015 (== VC14) and you want a release config libcurl
dll with WinSSL. Open a Visual Studio 2015 x86 command prompt and switch
to the winbuild directory then run:
nmake /f mode=dll VC=14 MACHINE=x86

The output will be lib,bin,include in

Here is an example from the second build method. For example you want
both platforms and you're using VS2015 and you want both Debug and
Release libcurl dll with OpenSSL DLLs.

Unzip openssl-1.0.2d so it's at the same directory level as curl, like
c:\foo\curl and c:\foo\openssl.

Go to projects\Windows open a command prompt (normal one, not visual
studio) and run:
build-openssl vc14 x86 debug
build-openssl vc14 x86 release
build-openssl vc14 x64 debug
build-openssl vc14 x64 release

Go to projects\Windows\VC14 and open curl-all.sln and do a batch build of:
DLL Debug - DLL OpenSSL|Win32
DLL Debug - DLL OpenSSL|x64
DLL Release - DLL OpenSSL|Win32
DLL Release - DLL OpenSSL|x64

The output will be lib and binaries in:
build\Win32\VC14\DLL Debug - DLL OpenSSL
build\Win64\VC14\DLL Debug - DLL OpenSSL
build\Win32\VC14\DLL Release - DLL OpenSSL
build\Win64\VC14\DLL Release - DLL OpenSSL

And in that case the include directory isn't copied to the build output
so you'd use the c:\foo\curl\include or copy it somewhere.

Last build method for Visual Studio is cmake, which I'm not using for
libcurl so I'm not too familiar with the setup there. If you need cmake
maybe someone else can fill you in.
List admin:
Received on 2015-10-21