Building OpenSSL for Visual Studio on Windows is mostly straight-forward, but it has some quirks. I’ll document the results of my wrestling here so that future attempts will be less painful.
What you need
You need to install…
- Visual Studio 2010 (this will likely work with older versions as well)
- ActivePerl 1
- Latest version of OpenSSL source-code 2
Setting up for the build
Unzip3 the OpenSSL source code into two different folders, one for the 32-bit build and one for the 64-bit build4. So, for example, you might end up with C:\openssl-src-32
and C:\openssl-src-64
.
Building the 32-bit static libraries
- Open the Visual Studio Command Prompt (2010)5.
-
cd
to your OpenSSL source folder for 32-bit (e.g.cd C:\openssl-src-32
). - Run the following: 6
Your outputs will be in C:\Build-OpenSSL-VC-32
.
Building the 32-bit static libraries with debug symbols
These steps will embed the debug symbols directly into the .lib
files. Don’t expect to see any .pdb
files.
- Open the Visual Studio Command Prompt (2010).
-
cd
to your OpenSSL source folder for 32-bit (e.g.cd C:\openssl-src-32
). - Run the following:
- In a text editor (like Notepad), open
ms\nt.mak
and replace all occurrences of/Zi
with/Z7
. There should be three replacements.7 - Run the following:
Your outputs will be in C:\Build-OpenSSL-VC-32-dbg
. Make sure you rename them to something likelibeay32-debug.lib
and ssleay32-debug.lib
.