064 - 问,Windows下如何编译OpenSSL

064 - 问,Windows下如何编译OpenSSL

OpenSSL

介绍

The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. The project is managed by a worldwide community of volunteers that use the Internet to communicate, plan, and develop the OpenSSL toolkit and its related documentation.

官网

http://www.openssl.org/

编译

下载perl

http://www.activestate.com/activeperl

安装后,将自动添加到环境变量。

下载OpenSSL源码

http://www.openssl.org/source/

这里我们找到openssl-0.9.8l.tar.gz。(最新版本没仔细研究,后面的步骤有点小区别。用这个版本足够了。)

064 - 问,Windows下如何编译OpenSSL_第1张图片

运行vc2008命令提示符

064 - 问,Windows下如何编译OpenSSL_第2张图片

编译release版本(默认release)

064 - 问,Windows下如何编译OpenSSL_第3张图片

wps_clip_image-6143

wps_clip_image-17729

如果编译mt的,nmake -f ms\nt.mak 。

wps_clip_image-7977

这样,就将头文件和lib、dll复制到第一步指定的目录(c:/openssl)中去了。

064 - 问,Windows下如何编译OpenSSL_第4张图片

编译debug版本

需要修改ms\do_ms.bat文件。

064 - 问,Windows下如何编译OpenSSL_第5张图片

也就是在文件mk1mf.pl 后面加上debug参数。

其他同编译release方法。

相关资料

这本书挺适合初学。

http://www.open-open.com/doc/view/43f2f2d2bc574e06bdfec9244df1fd97 


vs2010 编译:

When compiling OpenSSL 1.0.0 on Windows with Visual Studio 2010, it eventually threw a 0x2 error:

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0 \VC\BIN\cl.EXE"' : return code '0x2'

Stop.

It seems that this error will be thrown because of a flag in the perl Configure file, namely -WX. As the MSDN documentation states:

Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.

After removing the -WX occurrences in the Configure file and re-entering the commands stated here it built fine and passed all tests.

你可能感兴趣的:(064 - 问,Windows下如何编译OpenSSL)