場景
VS2015編譯openssl-1.1.1-pre1ide
工具
nasm-2.14rc0-installer-x64.exe
ActivePerl-5.24.3.2404-MSWin32-x64-404865.exe
openssl-1.1.1-pre1.tar.gz工具
環境變量
C:\Program Files\NASM(添加彙編器路徑)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin(VS2015編譯路徑)debug
操做
1)perl Configure VC-WIN32 [no-shared] [no-asm] [no-tests] [--debug] --prefix=d:\openssllib
VC-WIN32:可根據須要修改成64位等,no-shared爲編譯靜態庫,不加此項默認編譯出的是動態庫;no-tests爲不須要tests功能,若是隻須要openssl的庫能夠加上此項,不然可能會出不少錯誤致使編譯不過;--debug爲編譯debug版,不加此項默認編譯出的是release版。
2)nmake,編譯經過後再nmake install就安裝到--prefix=指定的目錄了。
3)若是要編譯多個版本(release,debug),最好先nmake clean下,再重複第3步驟。
注意:
1.VS工程的運行時庫(Runtime Library)選擇應與編譯出的openssl庫匹配,尤爲動態庫,不然可能編譯不過
2.須要使用靜態庫的時候,若是編譯不過,出現LNK2019等錯誤的時候,你可能還須要添加ws2_32.lib,crypt32.lib庫。
3.NASM彙編器沒有安裝出現以下錯誤
C:\Users\admin\Downloads\openssl-1.1.1-pre1>perl Configure VC-WIN32
Using implicit seed configuration
Configuring OpenSSL version 1.1.1-pre1 (0x10101001L) for VC-WIN32
NASM not found - please read INSTALL and NOTES.WIN for further details
4It looks like you don't have either nmake.exe or dmake.exe on your PATH錯誤解決方案
It looks like you don't have either nmake.exe or dmake.exe on your PATH,
so you will not be able to execute the commands from a Makefile. You can
install dmake.exe with the Perl Package Manager by running:
ppm install dmake
解決:執行ppm install dmake,安裝dmake。
說明:ppm是perl圖形化包管理工具,dmake是同GNU Make相似的工具,支持跨平臺
當前安裝VS2015,搜索到nmake.exe,而後執行vcvarsall.bat,而且添加了VS的nmake路徑到環境變量仍是有問題ssl