搜索
您的当前位置:首页正文

HOW to build OpenSSL with Visual

来源:二三娱乐

下面那一大堆都是自己以前的记录,但是前几天在翻看OpenSSL的源代码的时候突然想调试一下,所以就想着怎么用编出给VS调试用的OpenSSL Library。虽然后来没有实现自己的想法,不过找到一个不错的网站,上面有已经编译好的OpenSSL的Library还有编译方法。相比我的记录就更加全面了,所以记录一下。


@1

  1. Uncompress the openssl-1.0.1c.tar.gz, For example at C:\openssl-1.0.1c
  2. Install the ActivePerl
  3. Use the VS2005 Command Prompt
    Start->All Programs->Microsoft Vistual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt
> perl configure VC-WIN32
> ms\do_ms

If you want to build the dlls, input:

> nmake -f ms\ntdll.mak

if you want to build the libs, input:

> nmake -f ms\nt.mak
  1. when the compiling is finished, you can find the dll&exe in <openssl-1.0.1c/out32dll> folder or you can find the lib&exe in <openssl-1.0.1c/out32> folder.
  2. If you want use openssl api in you project, please include the <openssl-1.0.1c/inc32> folder in you project.

@2

OpenSSL 1.0.1k compile error

I try to buld openssl-1.0.1k with Visual Studio...

> PERL Configure VC-WIN32... 
> ms\do_nasm 
> NMAKE -f ms\nt.mak 

and have one error:

.\crypto\cversion.c(80) : error C2065: 'cflags' : undeclared identifier

Simple patch:

diff U3 a/openssl-1.0.1k/crypto/cversion.c b/openssl-1.0.1k/crypto/cversion.c 
--- a/openssl-1.0.1k/crypto/cversion.c  Thu Jan 08 08:00:56 2015 
+++ b/openssl-1.0.1k/crypto/cversion.c  Thu Jan 08 10:16:03 2015 
@@ -77,7 +77,7 @@ 
    if (t == SSLEAY_CFLAGS) 
     { 
 #ifdef CFLAGS 
-    return(cflags); 
+    return(CFLAGS); 
 #else 
     return("compiler: information not available"); 
 #endif 

@3

OpenSSL 1.0.2e compile error

Building 1.0.2e has error

Assembling: tmp32\sha1-586.asm
tmp32\sha1-586.asm(1432) : error A2070:invalid instruction operands
tmp32\sha1-586.asm(1576) : error A2070:invalid instruction operands
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\ml.EXE": return code "0x1"

The all asm SHOULD use NASM to build, so use NASM to replace the MS:

  1. Install the NASM, download from
  2. Add the NASM path to the $PATH

Build the OpenSSL:

> perl configure VC-WIN32
> ms\do_nasm
> nmake -f ms\nt.mak
Top