打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ActivePerl、dmake、nasm、nmake编译OpenSSL(1.1.0系列)
                  开篇提示:本文为本人原创,本文欢迎转载,但必须注明本文出处,例如:
“该文引用自 CruiseYoung的:“ActivePerl、dmake、nasm、nmake编译OpenSSL(1.1.0系列)”  http://blog.csdn.net/fksec/article/details/52667055”  
否则说明阁下愿意支付以100元人民币每字计的稿费,敬请留意。

注1:本文基于Win x64位平台来讲解,x86基本相同:

注2:ActivePerl、nasm、nmake编译OpenSSL(1.0.1系列):http://blog.csdn.net/fksec/article/details/25969257

1 下载软件包

1.1 ActivePerl(x64):http://www.activestate.com/activeperl/downloads
1.2 nasm(x64):http://www.nasm.us/
1.3 zlib编译见“nmake、cmake、Visual Studio编译zlib”:http://blog.csdn.net/fksec/article/details/25906419
1.4 OpenSSL:http://www.openssl.org/source/
      代码托管地址:https://github.com/openssl/openssl(在Tags中选对应版本进行下载,否则静态版本能编译通过,而动态版本编译不能通过)

2 准备工作

2.1 阅读:
2.1.1 编译方法
README
NOTES.WIN
Configurations\README
Configurations\windows-makefile.tmpl
2.1.2 编译选项
文件INSTALL
--with-zlib-include=DIR
--with-zlib-lib=LIB
zlib
zlib-dynamic
2.1.3 编译配置(方式)
文件INSTALL
注意以下内容:
$ perl d:\PATH\TO\OPENSSL\SOURCE\Configure {{ target }} [[ options ]]--prefix=OpenSSL--openssldir=SSL--with-zlib-include=DIR--with-zlib-lib=LIBzlibzlib-dynamic--debug--release  (default)no-sharedno-threads (default)threadson Windows (only pick one of the targets for configuration):$ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }$ nmake$ nmake test$ nmake install
2.2 编译环境:点击“开始”-->"所有程序"-->"Visual Studio 2013"-->"Visual Studio Tools"-->"VS2013 x64 本机工具命令提示" 
2.3 编译前工具安装(openssl-1.1.0系列):
2.3.1 安装nasm,下载链接http://www.nasm.us/
安装后,右击“我的电脑”-->属性-->高级-->环境变量-->系统变量-->path项添加:
D:\Tools\NASM
2.3.2 安装ActivePerl
2.3.2.1 安装ActivePerl
2.3.2.1 安装dmake(必须在联网的情况下),点击“开始”-->"所有程序"-->"Visual Studio 2013"-->"Visual Studio Tools"-->"VS2013 x64 本机工具命令提示" :
ppm install dmake
2.4 解压“openssl-1.1.0a.tar.gz”到当前文件夹,如得到“openssl-1.1.0a.tar”文件则再次解压“openssl-1.1.0a.tar”到当前文件夹,用以下命令切换到“openssl-1.1.0a”目录

3 Release编译

3.1 运行configure:
如果编译“openssl-1.1.0a”,执行:
cd /d E:\Projects\compile\openssl-1.1.0aperl Configure VC-WIN64A --release --prefix=D:\comm\openssl\release_x64 --openssldir=D:\comm\ssl\release_x64perl Configure VC-WIN64A --release --prefix=D:\comm\openssl\release_x64 --openssldir=D:\comm\ssl\release_x64 zlib --with-zlib-include=D:\comm\zlib\release_x64\include --with-zlib-lib=D:\comm\zlib\release_x64\lib\zdll.libperl Configure VC-WIN64A --release --prefix=D:\comm\openssl\release_x64 --openssldir=D:\comm\ssl\release_x64 zlib-dynamic --with-zlib-include=D:\comm\zlib\release_x64\include --with-zlib-lib=D:\comm\zlib\release_x64\lib\zdll.lib
注1:如果不需引入“zlib”库,则请用第1条perl命令;
注2:如果引入“zlib”静态库,则请用第2条perl命令;此方式适用于“zlib”一个工程内只有“OpenSSL”库用到或通过“OpenSSL”库用到“zlib”库的功能;这种方式编译需要修改openssl-1.1.0a\configdata.pm和openssl-1.1.0a\makefile两个文件,搜索 “/MD” 字符串,替换成 “/MT”, 这将导致静态链接 C 运行,避免了在目标机器上安装 VC 再发行包等等操作。
注3:如果引入“zlib”动态库,则请用第3条perl命令;此方式适用于所有情况;
注4:约定:本文“OpenSSL”静态库库引入“zlib”静态库,“OpenSSL”动态库引入“zlib”动态库;

3.2 编译、测试、安装、清除上次的编译以便重新编译:

nmake allnmake installnmake distclean

4 Debug编译

4.1 运行configure:
如果编译“openssl-1.1.0a”,执行:
cd /d E:\Projects\compile\openssl-1.1.0aperl Configure VC-WIN64A --debug --prefix=D:\comm\openssl\debug_x64 --openssldir=D:\comm\ssl\debug_x64perl Configure VC-WIN64A --debug --prefix=D:\comm\openssl\debug_x64 --openssldir=D:\comm\ssl\debug_x64 zlib --with-zlib-include=D:\comm\zlib\debug_x64\include --with-zlib-lib=D:\comm\zlib\debug_x64\lib\zdll.libperl Configure VC-WIN64A --debug --prefix=D:\comm\openssl\debug_x64 --openssldir=D:\comm\ssl\debug_x64 zlib-dynamic --with-zlib-include=D:\comm\zlib\debug_x64\include --with-zlib-lib=D:\comm\zlib\debug_x64\lib\zdll.lib
注1:如果不需引入“zlib”库,则请用第1条perl命令;
注2:如果引入“zlib”静态库,则请用第2条perl命令;此方式适用于“zlib”一个工程内只有“OpenSSL”库用到或通过“OpenSSL”库用到“zlib”库的功能;这种方式编译需要修改openssl-1.1.0a\configdata.pm和openssl-1.1.0a\makefile两个文件,搜索 “/MDd” 字符串,替换成 “/MTd”, 这将导致静态链接 C 运行,避免了在目标机器上安装 VC 再发行包等等操作。
注3:如果引入“zlib”动态库,则请用第3条perl命令;此方式适用于所有情况;
注4:约定:本文“OpenSSL”静态库库引入“zlib”静态库,“OpenSSL”动态库引入“zlib”动态库;

4.2 编译、测试、安装、清除上次的编译以便重新编译:
nmake allnmake installnmake distclean

5 如果不想编译,直接下载OpenSSL安装包

Binary Distributions:http://www.openssl.org/related/binaries.html
OpenSSL for Windows:http://www.slproweb.com/products/Win32OpenSSL.html

6 参考文章

在 Windows下用 Visual Studio 编译 OpenSSL 1.1.0:http://www.cnblogs.com/chinalantian/p/5819105.html

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
windows环境下VS2013编译openSSL
OpenSSL简介及在Windows系统上的编译步骤
Windows下OpenSSL安装配置
VS2015编译GEOS的debug和release版本
QT
Windows平台下Makefile学习笔记(一)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服