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:

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.


Anonymous Anonymous said...

I'm using Visual Studios 2012. How do I do this in VS2012? 'Navigate to winbuild sub-directory in cURL source directory' I don't have such thing like a winbuild directory.

4:29 PM  
Anonymous Anonymous said...

Did you download cURL from here:

Download curl-7.33.0.tar.gz (at the time of this writing) from the above link. Extract it to a directory in your computer.

Launch Visual Studio 2012 Command Prompt by following steps mentioned in these links:

Once Visual Studio 2012 Command Prompt is up, you can use "cd" command to change directory to "winbuild" directory in cURL source.

2:10 PM  
Anonymous Anonymous said...

Hi, I'm on Win8 with Visual 2012 Express Edition and I followed steps, but in winbuild when I run Nmake I get error:nmake: fatal error U1073: don't know how to make VC12

any help?

4:07 AM  
Anonymous Anonymous said...

I get a linking error "unresolved external symbol __imp__curl_easy_init"
when following your step and using the lib and headers.
How can I get around this ?

11:12 PM  
Anonymous Anonymous said...

Found the answer.
Need to add CURL_STATICLIB to project to avoid the linker error. Thanks for the tutorial

11:17 PM  
Anonymous Anonymous said...

Thanks a lot,

After trying to make build it through the IDE and spending tons of hours in many attempts to get it compiled the way I liked, this worked flawlessly. At the first try... I hope I have done this before :\

Thanks once again,

5:42 AM  
Blogger Dinesh Kumar said...

Thanks you for this. I built cURl 7.46 on Windows 8.1 using Visual Studio 2013 - using method above(nmake).

Haven't tested it yet, but should be fine i'm certain.

Thank u :)

3:11 AM  
Blogger Фуад Нуриев said...

Thanks a lot!!!

12:11 AM  
Blogger kongponleu88 said...

thanks for sharing this great blog.
please click here
gclub จีคลับ
gclub online

7:34 AM  
Blogger Anonymous said...

BramhaCorp provides Spacious 2 BHK & 3 BHK flats in Bavdhan Pune and Shops in Bavdhan , with all modern properties in Pune and closely connected facilities Flats in Bavdhan.

5:39 PM  
Blogger Shobhit Tyagi said...

Hi ,
I have successfully link the curl with ssl but it still requires ssleay32.dll and libeay32.dll in my system folder

I want to include both these dll into my executable.

So How to achieve this?

6:10 PM  
Blogger Maitreya Buddha said...

If my memory serves me right, the build process mentioned in this blog, produces BOTH DLLs(for dynamic linking) AND .LIBs for static linking; hence the title for the blog. :)
the static libraries are called "libcurl_a.lib"(release mode) and libcurl_a_debug.lib".

I have them built for Visual Studio 2008, 2010, 2013 and 2015; in both 32-bit and 64-bit(I think) and in DEBUG and RELEASE modes. If you want I can send them over to you by file share or something?

6:22 PM  
Blogger Shobhit Tyagi said...

I am using libcurl_a_debug.lib for static linking but when i use my application it still needs libeay32 and ssleay32 into system folder otherwise it gives me the following error.

The program can't start because LIBEAY32.dll is missing from your computer. Try reinstalling the program to fix this problem.

12:28 PM  

Post a Comment

<< Home