天天看點

Building OpenSSL with Visual Studio

I provide downloads for Visual Studio 2010 and 2015. I had to remove my 2013 installation due to space constraints, but the build files are still there so you can do it, too.

Version

Visual Studio 2010

Visual Studio 2015

OpenSSL 1.0.2d

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-release-dll-vs2010.7z">32-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-release-dll-vs2015.7z">32-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-debug-dll-vs2010.7z">32-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-debug-dll-vs2015.7z">32-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-release-static-vs2010.7z">32-Bit Release Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-release-static-vs2015.7z">32-Bit Release Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-debug-static-vs2010.7z">32-Bit Debug Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-32bit-debug-static-vs2015.7z">32-Bit Debug Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-release-dll-vs2010.7z">64-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-release-dll-vs2015.7z">64-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-debug-dll-vs2010.7z">64-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-debug-dll-vs2015.7z">64-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-release-static-vs2010.7z">64-Bit Release Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-release-static-vs2015.7z">64-Bit Release Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-debug-static-vs2010.7z">64-Bit Debug Static Library</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.2d-64bit-debug-static-vs2015.7z">64-Bit Debug Static Library</a>

OpenSSL 1.0.1p

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-release-dll-vs2010.7z">32-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-release-dll-vs2015.7z">32-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-debug-dll-vs2010.7z">32-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-debug-dll-vs2015.7z">32-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-release-static-vs2010.7z">32-Bit Release Static Library</a>

32-Bit Release Static Library [broken]

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-32bit-debug-static-vs2010.7z">32-Bit Debug Static Library</a>

32-Bit Debug Static Library [broken]

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-release-dll-vs2010.7z">64-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-release-dll-vs2015.7z">64-Bit Release DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-debug-dll-vs2010.7z">64-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-debug-dll-vs2015.7z">64-Bit Debug DLL</a>

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-release-static-vs2010.7z">64-Bit Release Static Library</a>

64-Bit Release Static Library [broken]

<a href="http://p-nand-q.com/programming/windows/openssl-1.0.1p-64bit-debug-static-vs2010.7z">64-Bit Debug Static Library</a>

64-Bit Debug Static Library [broken]

<code>rebuild_openssl_vs2010.cmd</code> for use with Visual Studio 2010

<code>rebuild_openssl_vs2013.cmd</code> for use with Visual Studio 2013

<code>rebuild_openssl_vs2015.cmd</code> for use with Visual Studio 2015

The script assumes you are on Windows.

The script assumes you have Visual Studio 2010, 2013 or 2015 installed in all the usual places. Important: If you have a different installation folder, your mileage may vary

Choose the script you want to use and edit it. For example, let's take a look at the top of <code>rebuild_openssl_vs2015.cmd</code>:

so it is pretty easy to see: you must enter the OpenSSL version manually, the rest should have sensible defaults...

Note: The script uses the SUBST T:\ drive for building OpenSSL.

Place the tar.gz file (not the unpacked .tar) in the root of T:\

Double-click on one of the rebuild_openssl-vs*.cmd.

That's it, it will do all the hard work for you and present nicely packaged binaries. Great fun!

The instructions default to the DLL build

Why? because that is the one used by Python. And because I was rebuilding Python, I was rebuilding OpenSSL in the first place. So there.

Debug build uses .PDBs

You need Visual Studio 2010, 2013 or 2015.

You need the OpenSSL sourcecode. In the following, both the 1.0.1 and 1.0.2 branches are supported.

Unzip the sourcecode.

You need a development prompt. This varies based on your compiler:

Visual Studio 2010, 32-bit: Open <code>Visual Studio Command Prompt (2010)</code>

Visual Studio 2010, 64-bit: Open <code>Visual Studio x64 Win64 Command Prompt (2010)</code>

Visual Studio 2013, 32-bit: Open <code>CMD.EXE</code> and run <code>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat</code>

Visual Studio 2013, 64-bit: Open <code>CMD.EXE</code> and run <code>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat</code>

Visual Studio 2015, 32-bit: Open <code>CMD.EXE</code> and run <code>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat</code>

Visual Studio 2015, 64-bit: Open <code>CMD.EXE</code> and run <code>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat</code>

Change to the source directory, for example <code>T:\openssl-src-32</code>

Run <code>perl Configure VC-WIN32 --prefix=T:\Build-OpenSSL-VC32-Release-DLL</code>. This will make <code>T:\Build-OpenSSL-VC32-Release-DLL</code>your output directory; it should be fairly obvious how you can change that.

Run <code>ms\do_ms</code>

If you are on the 1.0.2 branch, you must do the following: Run <code>ms\do_nasm</code>.

This step is not necessary if you are on 1.0.1

Run <code>nmake -f ms\ntdll.mak</code>

Run <code>nmake -f ms\ntdll.mak install</code>

Run <code>perl Configure debug-VC-WIN32 --prefix=T:\Build-OpenSSL-VC32-Debug-DLL</code>

Run <code>nmake -f ms\nt.mak</code>

Run <code>nmake -f ms\nt.mak install</code>

Change to the source directory, for example <code>T:\openssl-src-64</code>

Run <code>perl Configure VC-WIN64A --prefix=T:\Build-OpenSSL-VC64-Release-DLL</code>. This will make <code>T:\Build-OpenSSL-VC64-Release-DLL</code> your output directory; it should be fairly obvious how you can change that.

Run <code>ms\do_win64a</code>

Run <code>perl Configure debug-VC-WIN64A --prefix=T:\Build-OpenSSL-VC64-Debug-DLL</code>

Run <code>perl Configure VC-WIN64A --prefix=T:\Build-OpenSSL-VC64-Release-Static</code>. This will make <code>T:\Build-OpenSSL-VC64-Release-Static</code> your output directory; it should be fairly obvious how you can change that.

Because the OpenSSL build scripts will use the folder <code>outdll32</code> for both the 32-bit and the 64-bit output, so there is no easy way to distinguish both builds.

GK, December 12, 2015