欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > windows 平台编译openssl

windows 平台编译openssl

2025/3/28 8:48:00 来源:https://blog.csdn.net/weixin_43868793/article/details/146375679  浏览:    关键词:windows 平台编译openssl

文章目录

  • 准备环境
    • 安装perl
    • 安装NASM
    • 获取源码
  • 源码编译
    • 配置
    • 编译

准备环境

安装perl

下载Perl 5.40.0.1 Portable zip
strawberryperl

解压后设置系统环境变量
测试安装是否成功

perl --versionThis is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-threadCopyright 1987-2024, Larry WallPerl 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)

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词