Revision $Id: openssl-compile-msvs-mt.base,v 1.6 2006/05/08 19:24:52 klm Exp $ Purpose This recipe demonstrates how to build a static version of OpenSSL using Microsoft Visual Studio 6. Motivation When compiling WebJob, I prefer to link against statically compiled OpenSSL libraries. Since WebJob must be compiled as a multithreaded binary on WIN32 platforms, it is necessary to compile against a compatible set of OpenSSL libraries -- i.e., the standard OpenSSL build won't work. Requirements Cooking with this recipe requires Microsoft Visual Studio 6 and Active Perl 5.8.7 or higher. Note: Higher versions of Visual Studio have not been tested, so your results may vary. This recipe was last tested on openssl-0.9.8b. Solution The solution is to modify nt.mak to use /MT prior to building OpenSSL. The following steps describe how to implement this solution. 1. Unpack OpenSSL tar ball. 2. Open a command window and run: cd VCVARS32.bat perl Configure VC-WIN32 ms\do_ms 3. Edit ms\nt.mak and replace /MD with /MT in the CFLAG macro. This causes OpenSSL to link against multi-threaded libraries. notepad ms\nt.mak 4. Compile with: nmake -f ms\nt.mak 5. Test with: cd out32 ..\ms\test 6. Install OpenSSL using the script provided in Appendix 1. cd .. \install_openssl.cmd Closing Remarks Credits This recipe was brought to you by Klayton Monroe. Appendix 1 --- install_openssl.cmd --- md C:\OpenSSL md C:\OpenSSL\bin md C:\OpenSSL\lib md C:\OpenSSL\include md C:\OpenSSL\include\openssl copy /b inc32\OpenSSL\*.h C:\OpenSSL\include\openssl copy /b out32\ssleay32.lib C:\OpenSSL\lib copy /b out32\libeay32.lib C:\OpenSSL\lib copy /b out32\openssl.exe C:\OpenSSL\bin --- install_openssl.cmd ---