Windows XP SP3下编译安装openssl-1.1.0b

软件需要:

openssl-1.1.0b

visual studio 2010(cn_visual_studio_2010_ultimate_x86_dvd_532347.iso)

perl:ActivePerl-5.22.1.2201

nasm-2.12.03rc1-win32

环境准备:

1.从官网下载ActivePerl-5.22.1.2201并一路确认安装到硬盘中

2.打开命令提示符,第一次输入cpan会默认下载mingw,等待数分钟以后他会默认解压安装。

3.待mingw自动安装以后将会出现 cpan>提示符,在里面分别输入

install Test::More

install Text::Template

4.下载nasm-2.12.03rc1-win32并解压到d:\develop\2.12.03rc1\

在系统环境变量PATH添加D:\develop\nasm-2.12.03rc1;

以上准备工作做好了

编译:

编译过程中用过VC6/VC7均编译失败,后来网上找到原因:

openssl-1.0.0a必须用vs2008编译,VC6+nasm32是无法编译了,因为openssl-1.0.0a要求cl.exe的版本比较高,vc6无法编译,所以用vs2008编译。

本文选用了2010

vc7报错:

async_win.obj : error LNK2019: unresolved external symbol _ConvertFiberToThread referenced in function _async_local_cleanup
async_win.obj : error LNK2019: unresolved external symbol _ConvertThreadToFiber referenced in function _async_fibre_init_dispatcher
async.obj : error LNK2019: unresolved external symbol _DeleteFiber referenced in function _async_job_free
async.obj : error LNK2019: unresolved external symbol _SwitchToFiber referenced in function _async_start_func
async.obj : error LNK2019: unresolved external symbol _CreateFiber referenced in function _ASYNC_init_thread
b_print.obj : error LNK2019: unresolved external symbol __ftol2 referenced in function _roundv
b_print.obj : error LNK2019: unresolved external symbol __aulldvrm referenced in function _fmtint
bss_dgram.obj : error LNK2019: unresolved external symbol __aulldvrm referenced in function _dgram_ctrl
ct_prn.obj : error LNK2001: unresolved external symbol __aulldvrm
threads_win.obj : error LNK2019: unresolved external symbol _InitializeCriticalS
ectionAndSpinCount referenced in function _CRYPTO_THREAD_lock_new
libcrypto-1_1.dll : fatal error LNK1120: 8 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x1'
Stop.

vc6报错:

crypto\ec\curve25519.c(897) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(898) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3298) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3299) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3300) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3301) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3302) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3303) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3304) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3305) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3306) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
crypto\ec\curve25519.c(3307) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data

Stop.

以下是完整的编译安装步骤:

perl Configure VC-WIN32 zlib,zlib-dynamic --with-zlib-include=F:\zlib-1.2.8 --with-zlib-lib=F:\zlib-1.2.8\zdll.lib
nmake
nmake test
nmake install

成功以下将默认把openssl安装到C:\Program Files\OpenSSL,编译成品支持zlib/gzip解压缩,编程时请把zlib1.dll拷贝到程序目录

zlib-dynamic
Like "zlib", but has OpenSSL load the zlib library
dynamically when needed. This is only supported on systems
where loading of shared libraries is supported.

按照官方INSTALL所说zlib将会按需动态调用。

编程成功还没测试, 其中zlib是用vc6编译,openssl用vc10编译。

成品下载

上一篇:python--迭代器(Iterator)


下一篇:C# to IL 10 Exception Handling(异常处理)