windows 平台编译openssl
文章目录
- 准备环境
- 安装perl
- 安装NASM
- 获取源码
- 源码编译
- 配置
- 编译
准备环境
安装perl
下载Perl 5.40.0.1 Portable zip
strawberryperl
解压后设置系统环境变量
测试安装是否成功
perl --version
This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread
Copyright 1987-2024, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.
安装NASM
nasm官网
nasm-2.16.03-win64
下载解压后要加入系统环境变量中
获取源码
openssl官网
openssl源码3.4.1
源码编译
配置
打开VS2019 开发人员命令提示符
- x64 Native Tools Command Prompt for VS 2019
- x86 Native Tools Command Prompt for VS 2019
正确安装了VisualStudio2019的话可以在win菜单中打到,可以在win任务栏的搜索中搜到
进入openssl 源码目录
E:
cd E:\openssl\openssl-3.4.1
# 64位动态库(默认)
perl Configure VC-WIN64A --prefix=D:\openssl-output
# 32位静态库(无汇编优化)
perl Configure VC-WIN32 no-asm --prefix=D:\openssl-output[2,7](@ref)
关键参数说明:
- –prefix:指定输出目录(默认安装到系统路径)。
- no-asm:禁用汇编优化(避免 NASM 依赖问题)。
- no-shared:生成静态库(.lib 而非 .dll)。
使用64位编译,输出
perl Configure VC-WIN64A --prefix=D:\openssl-output
Configuring OpenSSL version 3.4.1 for target VC-WIN64A
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created makefile.in
Created makefile
Created include\openssl\configuration.h
**********************************************************************
*** ***
*** 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) ***
*** ***
**********************************************************************
编译
然后可以nmake
nmake # 仅编译
nmake test # 运行测试(可选,确保功能正常)
nmake install # 安装到 --prefix 指定目录[3,8](@ref)
原文地址:https://blog.csdn.net/weixin_43868793/article/details/146375679
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.kler.cn/a/595706.html 如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.kler.cn/a/595706.html 如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!