OpenSSL

Building OpenSSL with Visual Studio 2012 for 32- or 64-bit

OpenSSLFor our programmer (dev/ops) friends, we thought we’d share a little about building OpenSSL.  There are a lot of examples online, but we kept finding they had little glitches, not quite complete, etc.  So here is how we built it:

You need Perl installed.  ActiveState’s free community Perl install is just fine.

First, you need to decide on 32- or 64-bit.  Open a command prompt and change directory into the OpenSSL source folder, such as into D:\OpenSSL\openssl-1.0.1e.

NOTE: Don’t try to build debug and release, or 32-bit and 64-bit in the same folder.  I’d recommend having folders like:

D:\OpenSSL\openssl-1.0.1e_vs2012_32bit_rel

D:\OpenSSL\openssl-1.0.1e_vs2012_64bit_rel

Now, to build 32-bit:

call “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat” x86
perl Configure VC-WIN32 –prefix={directory where you want your final output files}
call ms\do_ms

For 64-bit:

perl Configure VC-WIN64A –prefix={directory where you want your final output files}
call ms\do_win64a

You’re not done.  Now you need to decide if you want a static library or a DLL.  From this point on, the 32- or 64-bit decision doesn’t matter.

For static library:

REM build OpenSSL
nmake -f ms\nt.mak 

REM copy files to your output folder
nmake -f ms\nt.mak install

REM run some tests to make sure your build works — look for “passed all tests”
nmake -f ms\nt.mak test

 

For a DLL:

REM build OpenSSL
nmake -f ms\ntdll.mak 

REM copy files to your output folder
nmake -f ms\ntdll.mak install

REM run some tests to make sure your build works — look for “passed all tests”
nmake -f ms\ntdll.mak test

 
Look in your output folder and you’ll find the openssl.exe, some link libraries, some DLLs if you wanted them and headers.  It’s a beautiful thing 😉
 

 

 

 


Posted

in

, , ,

by

Tags: