Re: Trouble building libcurl.lib
Date: Mon, 07 May 2018 11:49:46 -0400
Thanks for pointing out the CURL_STATICLIB requirement. That fixed the linking issue. I have provided more detail relating to the /deps vs WITH_DEVEL issue.
The main unresolved issue is that I cannot connect to an https: site. With libcurl.lib I get "Unsupported protocol." With libcurl_a.lib, I get either "Peer certificate cannot be authenticated with given CA certificates" or "Couldn't connect to server."
Here's a detailed explanation of what I have tried, and the results.
The directory structure I am using consists of a folder named curl-7.59.0, which contains (among others) the folders winbuild and deps (sibling directories). The folder deps contains the folders bin, include and lib from the openSSL installation.
Using a commandline window launched from within Visual Studio, I navigate to the curl-7.59.0\winbuild folder, and give the command:
nmake /f Makefile.vc mode=dll VC=10 WITH_SSL=dll
The compilation fails while building the object file for ..\lib\md5.c, with fatal error C1083: Cannot open include file: 'openssl/md5.h'. I would note that the proper reference would be '..\deps\include\openssl\md5.h' but perhaps the error message is not giving the full path attempted.
If I give this command:
nmake /f Makefile.vc mode=dll VC=10 WITH_DEVEL=c:\openssl WITH_SSL=dll
it compiles successfully. The library libcurl.lib links without error, but when calling an https: site with my application the error message is "Unsupported protocol."
When I compile with mode=static, WITH_DEVEL=c:\openssl and WITH_SSL=dll, it completes successfully, and links successfully in my application, but https: calls fail with "Peer certificate cannot be authenticated with given CA certificates". I downloaded the current cacert.pem, and included "curl_easy_setopt(curl, CURLOPT_SSLCERT, certpath);" in my code but the connection still fails.
In my application, I also tried CURLOPT_CAPATH with the path to cacert.pem, and CURLOPT_CAINFO with the path, and neither fixed the problem. (I did see that CURLOPT_CAPATH may not work with Windows.)
Building a static library without OpenSSL (relying on the default WinSSL instead) completes OK but when I link with that library, the connection fails with "Couldn't connect to server."
Finally, I built a DLL version (libcurl.lib) without OpenSSL (relying on WinSSL) and once again got "Unsupported protocol".
Received on 2018-05-07