在vs2010下编译OpenSSL

来源:互联网 发布:php网站修改教程 编辑:程序博客网 时间:2024/06/11 23:43

Building OpenSSL for Visual Studio

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

  1. Open the Visual Studio Command Prompt (2010)5.
  2. cd to your OpenSSL source folder for 32-bit (e.g. cd C:\openssl-src-32).
  3. 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.

  1. Open the Visual Studio Command Prompt (2010).
  2. cd to your OpenSSL source folder for 32-bit (e.g. cd C:\openssl-src-32).
  3. Run the following:
  4. In a text editor (like Notepad), open ms\nt.mak and replace all occurrences of /Zi with /Z7. There should be three replacements.7
  5. 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.


原创粉丝点击