【記錄】openssl 編譯過程遇到的各種讓人發狂的問題
安裝教程網上很多,不是很仔細介紹了,主要記錄一下編譯過程遇到的各種問題。
推薦:
openssl原始碼版本:openssl1.0.2o
我的環境:windows7、Vs2013、vc6.0
編譯openssl所需命令按順序共三條:
1、perl Comfigure VC-WIN32
2、ms\do_ms.bat
3、nmake -f ms\ntdll.mak
記得新增環境變數。
將 C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin 或者
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
配置後重啟命令列介面。
問題一
解決:
下載dmake,並且進行環境配置
我進行配置後又出問題:
解決:因為我下載的openssl原始碼是最新版本(openssl-1.1.1per6)的,可能和我的電腦不匹配,於是我重新下載了其它版本的openssl原始碼(openssl1.0.2o),成功配置openssl。
問題二
編譯 openssl1.0.2.o>nmake -f ms\ntdll.mak 時出現錯誤
1、問題:
“Command line waring D4002: ignoring unknown option ‘ --prelfix=C:\\openssl’uplink.c”
解決:“ --prelfix=”輸入有誤,改為“--perfix”
2、問題:
ms\uplink.c(11): fatal error C10803 : cannot open include file :‘windows.h’:No such file or directoy
nmake:fatal error U1077:‘C1’:return code ‘0x2’
解決:
在完成openssl1.0.2.o>ms\do_ms.bat 後先配置VC環境變數。
C:\>cd C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin
C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin>VCVARS32.bat
出現提示:Setting environment for using Microsoft Visual C++ tools
表示配置成功。
如果配置了vc環境變數還是無法解決的,建議小夥伴們下載Visual Studio 2013 。
再按上述步奏配置Visual Studio 2013 的環境變數。
記得將C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin 新增到環境變數path中。
以下是我同學某小仙女遇到的也一起記下來
執行命令 Openssl1.0.2.o>nmake -f ms\ntdll.mak出現的問題
1、
cversion.c.\crypto\cversion.c(80) : error C2065: 'cflags' : undeclared identifier
.\crypto\cversion.c(80) : warning C4047: 'return' : 'const char *' differs in le
vels of indirection from 'int '
NMAKE : fatal error U1077: 'cl' : return code '0x2'
解決:
開啟C:\openssl1.0.2.o(openssl的安裝目錄)\crypto\cversion.c
在80行 return(cflags); 改成 return(CFLAGS);
2、
提示
'ml' 不是內部或外部命令,也不是可執行的程式或批處理檔案。
解決:
下載masm並把其中的ml.exe拷貝至 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin 下。
3、提示
.\apps\s_cb.c(803) : error C2027: use of undefined type 'in6_addr'
.\apps\s_cb.c(803) : see declaration of 'in6_addr'
.\apps\s_cb.c(836) : error C2027: use of undefined type 'in6_addr'
.\apps\s_cb.c(836) : see declaration of 'in6_addr'
.\apps\s_cb.c(884) : error C2027: use of undefined type 'in6_addr'
.\apps\s_cb.c(884) : see declaration of 'in6_addr'
.\apps\s_cb.c(917) : error C2027: use of undefined type 'in6_addr'
.\apps\s_cb.c(917) : see declaration of 'in6_addr'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
解決:
這是因為IPv6出錯
將openssl一開始編譯的第一條命令“perl Configure VC-WIN32”改為“perl Configure VC-WIN32 -DOPENSSL_USE_IPV6=0 ”
4、提示
缺少 mspdb60.dll
編譯後我們可以執行“nmake -f ms\ntdll.mak test ”測試安裝是否成功
解決:
將mspdb60.dll複製到C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin 下即可。
私推一下公眾號哈哈哈