文章目錄
- 準備環境
- 安裝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)