This howto is for building the latest version of openssl (1.0.1) on the latest version of the Microsoft Windows Desktop operating system (Windows 7 64 bit) using the latest Microsoft compiler (Visual Studio 2011 beta), targeting the 32 bit architecture.
- Get OpenSSL 1.0.1
- Get the latest package of git for windows (this includes perl which we need)
- Open the Visual Studio 2011 Developer Command Prompt
- Launch sh from git-msys (look for the your correct command by inspecting the Git bash link):
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
- Move to the folder where you have extracted the openssl source archive
cd cd Desktop/openssl-1.0.1/
- Run autoconfig and prepare make files; ignore the prefix; the sample below only builds suffort for a few ciphers: aes md5 rc4 rsa sha mac md2
perl Configure VC-WIN32 -DOPENSSL_NO_HW no-asm no-static-engine no-bf no-cast no-des no-dh no-dsa no-mdc2 no-rc2 no-rc5 no-capieng --prefix=c:/some/openssl/dir
- Create a shell script to emulate the ms/do_ms.bat batch file:
cat > ms/do_ms.sh perl util/mkfiles.pl >MINFO perl util/mk1mf.pl no-asm VC-WIN32 > ms/nt.mak perl util/mk1mf.pl dll no-asm VC-WIN32 > ms/ntdll.mak perl util/mkdef.pl 32 libeay > ms/libeay32.def perl util/mkdef.pl 32 ssleay > ms/ssleay32.def ^D
- Launch the shell script you just created
- Build the static and dynamic libraries:
nmake -f ms/nt.mak
- At the end of the process copy the include files openssl-1.0.1/inc32/openssl as openssl to your preferred include path, then copy the static library out32/libeay32.lib to your preferred library path.
Excellent HOWTO. This saved me hours of work.
Thanks for this blog. But I don’t see “Util” folder in openSSL 1.0.1c package. Any idea?
What about lowercase util as in openssl-1.0.1c/util ?
It is strange that there is no util/Util folder in 1.0.1c package.
I do see it in other packages such as 0.9.6c, 0.9.6k, 0.9.7b and 1.0.0d.
Get once again your OpenSSL sources from here: http://openssl.org/source/ then extract them using a good tool such as 7zip.
There is no uppercase Util directoly anywhere in any of the packages you mention. This uppercase Util is also not mentioned in this howto.
Paolog, I re-downloaded the package, and extracted it using WinRar. Now I can see the util folder. Thanks for your help.
I need to compile a 64-bit version. Any ideas?
I have never tried that myself. I’d say, at step 3, Open the 64 bit Visual Studio 2011 Developer Command Prompt.
Then every time there is a 32 in the scripts, replace that with 64, as in “perl Configure VC-WIN32” => “perl Configure VC-WIN64”.
The big question is: is that architecture supported ? I don’t know for sure.
“Visual Studio 2011 beta”
Did you mean Visual Studio 2012 beta? Or maybe Visual Studio 11 beta?
Sure ! That was a typo