openssl windows 平台使用 VS2017 编译openssl源码

 

//原作者

https://www.cnblogs.com/xiacaojun/p/10791307.html

{

1)依赖安装

  • 安装 perl 脚本解释器
  • 安装 nasm 汇编器
    • C:\Users\xiaca\AppData\Local\bin\NASM
    • 下载 http://libevent.net/download
    • 默认会安装用户目录
      • C:\Users\用户名\AppData\Local\bin\NASM
    • 配置windows的环境变量,将此路径加入到环境变量path中
  • 安装好后,重新打开控制台能够运行nasm 和perl命令

2)编译工具:VS2017社区版本

3)下载 openssl 1.1.1 源码

4) 编译步骤

  • (1)进入控制台(运行 CMD),或者编写批处理bat文件,如果输出路径在C盘 用管理员方式登录
  • (2)运行vs编译环境
    • 打开菜单中VS2017中有对应的命令行工具,把地址复制过来
    • 编译32位库版本
      • C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_x86.bat
    • 编译64位库版本
      • "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
  • (3)进入openssl源码吗目录
    • cd openssl-1.1.1
  • (4)使用perl生成makefile文件
    • 命令说明
      • perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE } --prefix=%OUTPATH%
      • VC-WIN32 表示生成32位程序
      • --prefix 是编译后输出的路径,默认会生成到C:\Program Files (x86)目录
    • 执行命令
      • perl Configure VC-WIN32
  • (5)用nmake编译
    • nmake
      • 编译库源码
    • nmake test
      • 编译测试程序
    • nmake install
      • 将编译好的文件安装到指定目录,默认是C:\Program Files (x86)\OpenSSL,如果是在C盘,运行控制台是需要有管理员权限

编译好后生成的文件,用于其他项目库的编译,或者复制到需要编译的路径中

 

}

本人附加

//参考 https://www.bilibili.com/video/BV1ap411f7p1?from=search&seid=2200916597013007830

无废话

 

{

安装perl nasm  配置环境变量

//必须vs 的开发工具,否则包含目录及库目录和链接会大量的出错

打开vs的开发命令提示符,x64 的

解压到C:/

进入openssl 根目录

执行 perl ./Configure --perfix=H:/library/openssl/openssl/build --openssldir=H:/library/openssl/openssl/build VC-WIN64A

直到

{Configuring OpenSSL version 3.0.0-alpha9-dev for target VC-WIN64A
Using os-specific seed configuration
Creating configdata.pm
Running configdata.pm
Creating makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL.md file first)      ***
***                                                                ***
**********************************************************************}

ok

 

nmake

nmake install

..

over

反馈 YZFHKM@163.com 邮件

}

{

 

 

}

 

posted @ 2020-11-17 06:46  YZFHKMS-X  阅读(638)  评论(0编辑  收藏  举报