Adapated from Aron P. Dobos, originally written in October 2013 and updated March 2017
-
Download software:
a. ActivePerl: http://www.activestate.com/activeperl/downloads
b. OpenSSL 1.0.1c http://www.openssl.org/source/openssl-1.0.1c.tar.gz
c. Libssl 1.4.2 http://www.libssh2.org/download/libssh2-1.4.2.tar.gz
d. Curl 7.28.0 http://curl.haxx.se/download/curl-7.28.0.zip
e. Netwide assembler http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip
-
Install ActivePerl if you don’t already have it.
-
Create a folder c:\curl and un-tar openssl, libssl, and curl into this folder.
-
Start menu -> run -> cmd.exe.
-
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
-
Enter the command and press enter:
vcvars32.bat
. -
Test by typing
cl.exe
. Output should look like this:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build>cl Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x86 Copyright (C) Microsoft Corporation. All rights reserved.
-
Unzip the netwide assembler binaries to c:\nasm-2.13.03.
-
Add it to the path
path = %PATH%;C:\nasm-2.13.03
. -
cd
c:\curl\openssl-1.0.1c
-
perl Configure VC-WIN32 –-prefix=c:/curl/openssl_dll
-
ms\do_nasm
-
nmake –f ms\ntdll.mak
-
nmake –f ms\ntdll.mak test
-
nmake –f ms\ntdll.mak install
-
Open VS 2017.
-
Open c:\curl\libssh2-1.4.2\win32\libssh2.dsw.
-
Allow VS2017 to upgrade the project file.
-
On the toolbar, select the “OpenSSL DLL Release” "x86" configuration.
-
Right click on ‘libssh2’ in the solution explorer, and select ‘Properties’.
a. Under ‘C/C++/General/Additional Include Directories’, add c:\curl\openssl_dll\include;
b. Under ‘Linker/General/Additional Library Directories’, add c:\curl\openssl_dll\lib;
c. Under ‘Linker/Input’, remove zlib.lib.
-
In libssh2_config.h, comment out line 25 to prevent conflict with snprintf defined in stdio.h
-
Build the solution C:\curl\libssh2-1.4.2\win32\Release_dll should have the files libssh2.dll and libssh2.lib. You might get errors about the “tests” project not finding libeay32.lib, but you can probably ignore this.
-
Close the project. Open C:\curl\curl-7.28.0\lib\libcurl.vcproj – allow VS2017 to upgrade the project file.
-
Select the ‘Release’ build.
-
In solution explorer, select properties of ‘libcurl’.
-
In General, select Configuration Type = ‘Dynamic Library (.dll)’ , then click “Apply” in the dialog.
-
Under C/C++/General/Additional Include Directories, add C:\curl\openssl-1.0.1c\inc32;C:\curl\libssh2-1.4.2\include; c:\curl\openssl_lib\include; c:\curl\openssl_lib\include\openssl.
-
Under C/C++/Preprocessor/Preprocessor Definitions/, add USE_OPENSSL;USE_LIBSSH2;CURL_DISABLE_LDAP;HAVE_LIBSSH2;HAVE_LIBSSH2_H;LIBSSH2_WIN32 ;LIBSSH2_LIBRARY;USE_SSLEAY
-
Under Linker/Input/Additional Dependencies, add libssh2.lib;libeay32.lib;ssleay32.lib;ws2_32.lib
-
Under Linker/General/Additional Library Directories, add C:\curl\libssh2-1.4.2\win32\Release_dll;c:\curl\openssl_dll\lib
-
Build. It should succeed.
-
Now you have all the dlls, libs, and relevant header files to include in other VC2013 projects that use the v120 C runtime.
-
Aggregate all the headers and binaries into a single “redistributable” with these commands:
a.
>> copy C:\curl\curl-7.28.0\lib\Release\libcurl.dll c:\curl\openssl_dll\bin
b.
>> copy C:\curl\curl-7.28.0\lib\Release\libcurl.lib c:\curl\openssl_dll\lib
c.
>> copy C:\curl\curl-7.28.0\lib\Release\libcurl.exp c:\curl\openssl_dll\lib
d.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.dll c:\curl\openssl_dll\bin
e.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.lib c:\curl\openssl_dll\lib
f.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.exp c:\curl\openssl_dll\lib
g.
>> mkdir c:\curl\openssl_dll\include\ssh
h.
>> copy c:\curl\libssh2-1.4.2\include\* c:\curl\openssl_dll\include\ssh
i.
>> mkdir c:\curl\openssl_dll\include\curl
j.
>> copy c:\curl\curl-7.28.0\include\curl\* c:\curl\openssl_dll\include\curl
-
Rename the c:\curl\openssl_dll folder to libcurl_ssl_vs2017_win32.
-
If you’re doing this right after having finished up the 32 bit build above, create a subfolder in c:\curl called “win32-build” and move all the current contents of c:\curl (except the untouched tar.gz files) into c:\curl\win32-build.
-
Close the command prompt and open a new one to refresh the environment variables.
-
Change to c:\curl and untar the three libraries: curl-7.28.0, libssh2-1.4.2, openssl-1.0.1c.
-
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
-
Enter the command and press enter>> vcvarsall.bat x86_amd64.
-
Test by typing
cl.exe
. Output should look like this:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build>cl Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
-
Unzip the netwide assembler binaries to c:\nasm-2.13.03.
-
Add it to the path path = %PATH%;C:\nasm-2.13.03
-
cd c:\curl\openssl-1.0.1c
-
perl Configure VC-WIN64A –-prefix=c:/curl/openssl_dll
-
ms\do_win64a
-
nmake –f ms\ntdll.mak
-
nmake –f ms\ntdll.mak test
-
nmake –f ms\ntdll.mak install
-
Open VS 2017
-
Open c:\curl\libssh2-1.4.2\win32\libssh2.dsw
-
Allow VS2017 to upgrade the project file
-
Click on the dropdown button next to “Win32” and open the “Configuration Manager”
-
Under “Active solution platform”, select “<New…>” and click OK to create x64 configuration.
-
Under “Active solution configuration”, select “DLL Release”
-
Right click on ‘libssh2’ in the solution explorer, and select ‘Properties’
a. Under ‘C/C++/General/Additional Include Directories’, add c:\curl\openssl_dll\include;
b. Under ‘Linker/General/Additional Library Directories’, add c:\curl\openssl_dll\lib;
c. Under ‘Linker/Input’, remove zlib.lib
-
In libssh2_config.h, comment out line 25 to prevent conflict with snprintf defined in stdio.h
-
Build the solution C:\curl\libssh2-1.4.2\win32\Release_dll should have the files libssh2.dll and libssh2.lib. You might get errors about the “tests” project not finding libeay32.lib, but you can probably ignore this.
-
Close the project. Open C:\curl\curl-7.28.0\lib\libcurl.vcproj – allow VS2017 to upgrade the project file.
-
In the configuration manager, create a new “x64” platform, and select the ‘Release’ build.
-
In solution explorer, select properties of ‘libcurl’.
-
In General, select Configuration Type = ‘Dynamic Library (.dll)’, then click “Apply” in the dialog
-
Under C/C++/General/Additional Include Directories, add C:\curl\openssl-1.0.1c\inc32;C:\curl\libssh2-1.4.2\include; c:\curl\openssl_lib\include; c:\curl\openssl_lib\include\openssl
-
Under C/C++/Preprocessor/Preprocessor Definitions/ add USE_OPENSSL;USE_LIBSSH2;CURL_DISABLE_LDAP;HAVE_LIBSSH2;HAVE_LIBSSH2_H;LIBSSH2_WIN32 ;LIBSSH2_LIBRARY;USE_SSLEAY
-
Under Linker/Input/Additional Dependencies, add libssh2.lib;libeay32.lib;ssleay32.lib;ws2_32.lib
-
Under Linker/General/Additional Library Directories, add C:\curl\libssh2-1.4.2\win32\Release_dll;c:\curl\openssl_dll\lib
-
Build. It should succeed.
-
Now you have all the 64-bit dlls, libs, and relevant header files to include in other VS2014 projects that use the v140 C runtime.
-
Aggregate all the headers and binaries into a single “redistributable” with these commands:
a.
>> copy C:\curl\curl-7.28.0\lib\x64\Release\libcurl.dll c:\curl\openssl_dll\bin
b.
>> copy C:\curl\curl-7.28.0\lib\x64\Release\libcurl.lib c:\curl\openssl_dll\lib
c.
>> copy C:\curl\curl-7.28.0\lib\x64\Release\libcurl.exp c:\curl\openssl_dll\lib
d.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.dll c:\curl\openssl_dll\bin
e.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.lib c:\curl\openssl_dll\lib
f.
>> copy C:\curl\libssh2-1.4.2\win32\Release_dll\libssh2.exp c:\curl\openssl_dll\lib
g.
>> mkdir c:\curl\openssl_dll\include\ssh
h.
>> copy c:\curl\libssh2-1.4.2\include\* c:\curl\openssl_dll\include\ssh
i.
>> mkdir c:\curl\openssl_dll\include\curl
j.
>> copy c:\curl\curl-7.28.0\include\curl\* c:\curl\openssl_dll\include\curl
-
Rename the c:\curl\openssl_dll folder to libcurl_ssl_vs2017_x64.