在windows上编译OpenSSL 1.0.1

在windows上编译OpenSSL 1.0.1,openssl,nmake,cl.exe,Openssl,Nmake,Cl.exe,我正在尝试为windows编译openssl。这是我第一次在没有合适的VisualStudio项目文件的情况下编译任何东西 我跟随导游来到这里: 除了在启动git之前发布vcvarsall.bat的细节 遗憾的是,cl.exe现在返回错误代码0x02 我该如何解决这个问题?有没有什么地方可以让我获得windows版openSSL 1.0.1的预编译二进制文件 错误日志: Building OpenSSL cl /Fotmp32\e_capi.obj -Iinc32 -Itmp32 -D

我正在尝试为windows编译openssl。这是我第一次在没有合适的VisualStudio项目文件的情况下编译任何东西

我跟随导游来到这里: 除了在启动git之前发布vcvarsall.bat的细节

遗憾的是,cl.exe现在返回错误代码0x02

我该如何解决这个问题?有没有什么地方可以让我获得windows版openSSL 1.0.1的预编译二进制文件

错误日志:

    Building OpenSSL
cl /Fotmp32\e_capi.obj  -Iinc32 -Itmp32 -DOPENSSL_NO_HW  /MT /Ox /O2 /Ob2 -DOPENSSL_THREADS  -DDSO_WIN32 -DOPENSSL_NO_HW -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_BF -DOPENSSL_NO_CAST -DOPENSSL_NO_DES -DOPENSSL_NO_DSA -DOPENSSL_NO_DH -DOPENSSL_NO_KRB5 -DOPENSSL_NO_GOST -DOPENSSL_NO_JPAKE -DOPENSSL_NO_DYNAMIC_ENGINE /Zl /Zi /Fdtmp32/lib -c .\engines\e_capi.c
e_capi.c
.\engines\e_capi.c(150) : error C2143: syntax error : missing '{' before '*'
.\engines\e_capi.c(424) : error C2079: 'capi_dsa_method' uses undefined struct 'dsa_method'
.\engines\e_capi.c(426) : warning C4047: 'initializing' : 'int' differs in levels of indirection from 'char [21]'
.\engines\e_capi.c(427) : error C2078: too many initializers
.\engines\e_capi.c(463) : warning C4013: 'DSA_get_ex_new_index' undefined; assuming extern returning int
.\engines\e_capi.c(464) : warning C4013: 'DSA_OpenSSL' undefined; assuming extern returning int
.\engines\e_capi.c(464) : warning C4047: '=' : 'const DSA_METHOD *' differs in levels of indirection from 'int'
.\engines\e_capi.c(465) : error C2224: left of '.dsa_do_verify' must have struct/union type
.\engines\e_capi.c(465) : error C2037: left of 'dsa_do_verify' specifies undefined struct/union 'dsa_method'
.\engines\e_capi.c(466) : error C2224: left of '.dsa_mod_exp' must have struct/union type
.\engines\e_capi.c(466) : error C2037: left of 'dsa_mod_exp' specifies undefined struct/union 'dsa_method'
.\engines\e_capi.c(467) : error C2224: left of '.bn_mod_exp' must have struct/union type
.\engines\e_capi.c(467) : error C2037: left of 'bn_mod_exp' specifies undefined struct/union 'dsa_method'
.\engines\e_capi.c(538) : warning C4133: 'function' : incompatible types - from 'int *' to 'const DSA_METHOD *'
.\engines\e_capi.c(700) : warning C4013: 'DSA_new_method' undefined; assuming extern returning int
.\engines\e_capi.c(700) : warning C4047: '=' : 'DSA *' differs in levels of indirection from 'int'
.\engines\e_capi.c(703) : error C2037: left of 'p' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(704) : error C2037: left of 'q' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(705) : error C2037: left of 'g' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(706) : error C2037: left of 'pub_key' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(707) : error C2037: left of 'p' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(707) : error C2037: left of 'q' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(707) : error C2037: left of 'g' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(707) : error C2037: left of 'pub_key' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(709) : error C2037: left of 'p' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(709) : warning C4133: 'function' : incompatible types - from 'unsigned char *' to 'BIGNUM *'
.\engines\e_capi.c(709) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'DWORD'
.\engines\e_capi.c(709) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(709) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(712) : error C2037: left of 'q' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(712) : warning C4133: 'function' : incompatible types - from 'unsigned char *' to 'BIGNUM *'
.\engines\e_capi.c(712) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'int'
.\engines\e_capi.c(712) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(712) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(715) : error C2037: left of 'g' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(715) : warning C4133: 'function' : incompatible types - from 'unsigned char *' to 'BIGNUM *'
.\engines\e_capi.c(715) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'DWORD'
.\engines\e_capi.c(715) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(715) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(718) : error C2037: left of 'pub_key' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(718) : warning C4133: 'function' : incompatible types - from 'unsigned char *' to 'BIGNUM *'
.\engines\e_capi.c(718) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'DWORD'
.\engines\e_capi.c(718) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(718) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(722) : warning C4013: 'DSA_set_ex_data' undefined; assuming extern returning int
.\engines\e_capi.c(727) : warning C4013: 'EVP_PKEY_assign_DSA' undefined; assuming extern returning int
.\engines\e_capi.c(748) : warning C4013: 'DSA_free' undefined; assuming extern returning int
.\engines\e_capi.c(952) : error C2143: syntax error : missing '{' before '*'
.\engines\e_capi.c(957) : error C2065: 'DSA_SIG' : undeclared identifier
.\engines\e_capi.c(957) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(957) : warning C4047: '=' : 'int' differs in levels of indirection from 'void *'
.\engines\e_capi.c(957) : error C2106: '=' : left operand must be l-value
.\engines\e_capi.c(958) : error C2275: 'CAPI_KEY' : illegal use of this type as an expression
        .\engines\e_capi.c(124) : see declaration of 'CAPI_KEY'
.\engines\e_capi.c(958) : error C2065: 'capi_key' : undeclared identifier
.\engines\e_capi.c(959) : error C2275: 'CAPI_CTX' : illegal use of this type as an expression
        .\engines\e_capi.c(123) : see declaration of 'CAPI_CTX'
.\engines\e_capi.c(959) : error C2065: 'ctx' : undeclared identifier
.\engines\e_capi.c(960) : error C2143: syntax error : missing ';' before 'type'
.\engines\e_capi.c(962) : error C2065: 'ctx' : undeclared identifier
.\engines\e_capi.c(962) : error C2037: left of 'engine' specifies undefined struct/union 'dsa_st'
.\engines\e_capi.c(962) : warning C4047: 'function' : 'const ENGINE *' differs in levels of indirection from 'int'
.\engines\e_capi.c(962) : warning C4024: 'ENGINE_get_ex_data' : different types for formal and actual parameter 1
.\engines\e_capi.c(962) : error C2198: 'ENGINE_get_ex_data' : too few arguments for call
.\engines\e_capi.c(962) : warning C4047: '=' : 'int' differs in levels of indirection from 'void *'
.\engines\e_capi.c(964) : error C2065: 'ctx' : undeclared identifier
.\engines\e_capi.c(964) : warning C4047: 'function' : 'CAPI_CTX *' differs in levels of indirection from 'int'
.\engines\e_capi.c(964) : warning C4024: 'CAPI_trace' : different types for formal and actual parameter 1
.\engines\e_capi.c(966) : error C2065: 'capi_key' : undeclared identifier
.\engines\e_capi.c(966) : warning C4013: 'DSA_get_ex_data' undefined; assuming extern returning int
.\engines\e_capi.c(968) : error C2065: 'capi_key' : undeclared identifier
.\engines\e_capi.c(981) : error C2065: 'capi_key' : undeclared identifier
.\engines\e_capi.c(981) : error C2223: left of '->hprov' must point to struct/union
.\engines\e_capi.c(981) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'HCRYPTHASH *'
.\engines\e_capi.c(981) : warning C4024: 'CryptCreateHash' : different types for formal and actual parameter 4
.\engines\e_capi.c(981) : error C2198: 'CryptCreateHash' : too few arguments for call
.\engines\e_capi.c(998) : error C2065: 'csigbuf' : undeclared identifier
.\engines\e_capi.c(999) : error C2065: 'capi_key' : undeclared identifier
.\engines\e_capi.c(999) : error C2223: left of '->keyspec' must point to struct/union
.\engines\e_capi.c(999) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'void *'
.\engines\e_capi.c(999) : warning C4024: 'CryptSignHashA' : different types for formal and actual parameter 2
.\engines\e_capi.c(999) : error C2065: 'csigbuf' : undeclared identifier
.\engines\e_capi.c(999) : warning C4133: 'function' : incompatible types - from 'DWORD *' to 'BYTE *'
.\engines\e_capi.c(999) : error C2198: 'CryptSignHashA' : too few arguments for call
.\engines\e_capi.c(1007) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1007) : warning C4013: 'DSA_SIG_new' undefined; assuming extern returning int
.\engines\e_capi.c(1008) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1010) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1010) : error C2223: left of '->r' must point to struct/union
.\engines\e_capi.c(1011) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1011) : error C2223: left of '->s' must point to struct/union
.\engines\e_capi.c(1012) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1012) : error C2223: left of '->r' must point to struct/union
.\engines\e_capi.c(1012) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1012) : error C2223: left of '->s' must point to struct/union
.\engines\e_capi.c(1014) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1014) : error C2223: left of '->r' must point to struct/union
.\engines\e_capi.c(1014) : error C2065: 'csigbuf' : undeclared identifier
.\engines\e_capi.c(1014) : warning C4047: 'function' : 'BIGNUM *' differs in levels of indirection from 'int'
.\engines\e_capi.c(1014) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 1
.\engines\e_capi.c(1014) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'int'
.\engines\e_capi.c(1014) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(1014) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(1015) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1015) : error C2223: left of '->s' must point to struct/union
.\engines\e_capi.c(1015) : error C2065: 'csigbuf' : undeclared identifier
.\engines\e_capi.c(1015) : warning C4047: 'function' : 'BIGNUM *' differs in levels of indirection from 'int'
.\engines\e_capi.c(1015) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 1
.\engines\e_capi.c(1015) : warning C4047: 'function' : 'unsigned char *' differs in levels of indirection from 'int'
.\engines\e_capi.c(1015) : warning C4024: 'lend_tobn' : different types for formal and actual parameter 2
.\engines\e_capi.c(1015) : error C2198: 'lend_tobn' : too few arguments for call
.\engines\e_capi.c(1017) : warning C4013: 'DSA_SIG_free' undefined; assuming extern returning int
.\engines\e_capi.c(1017) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1018) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1018) : warning C4047: '=' : 'int' differs in levels of indirection from 'void *'
.\engines\e_capi.c(1026) : error C2065: 'csigbuf' : undeclared identifier
.\engines\e_capi.c(1026) : warning C4022: 'OPENSSL_cleanse' : pointer mismatch for actual parameter 1
.\engines\e_capi.c(1028) : error C2065: 'ret' : undeclared identifier
.\engines\e_capi.c(1028) : warning C4047: 'return' : 'int *' differs in levels of indirection from 'int'
.\engines\e_capi.c(1034) : warning C4047: '=' : 'CAPI_KEY *' differs in levels of indirection from 'int'

我遇到了同样的问题。 调查时,我发现openssl文件夹中实际上有两个include目录:include和inc32。“include”文件夹中的文件不是有效的C/C++头文件,但出于某种原因,编译器使用此include目录而不是inc32(在我的例子中,罪魁祸首是我使用的其他人的自定义批处理脚本)。 希望有帮助

init_xp.cmd
call "%VS140COMNTOOLS%\..\..\VC\bin\vcvars32.bat"

set __OPENSSL_VER__=102l
perl Configure VC-WIN32 no-shared threads --prefix=C:\Dev\OpenSSL_%__OPENSSL_VER__%_vs2015_32_xp --openssldir=C:\Dev\OpenSSL_Config_%__OPENSSL_VER__%
if ERRORLEVEL 1 goto :ERROR
call ms\do_ms
call ms\do_nasm
nmake -f ms\nt.mak clean
nmake -f ms\nt.mak
nmake -f ms\nt.mak install

它帮助了我:“call ms\do_ms”

我也面临同样的问题,但我的openssl中只有include文件夹