在Windows 7 64位上构建OpenSSL时遇到问题

时间:2017-11-03 11:31:21

标签: visual-studio makefile compiler-errors openssl nmake

我正在尝试在Windows 7上为工作项目构建OpenSSL,但我遇到了麻烦。

INSTALL指令说明了这样做的简单方法:

Quick Start
-----------

If you want to just get on with it, do:

on Windows (only pick one of the targets for configuration):

$ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }
$ nmake
$ nmake test
$ nmake install

我能够运行 perl配置VC-WIN64A 没问题。但是,当我尝试运行nmake时,我得到以下输出:

>C:\Users\jget952\Downloads\openssl-1.1.0f>"C:\Program Files (x86)\Microsoft >Visual Studio 14.0\VC\bin\amd64\nmake.exe"
>
>Microsoft (R) Program Maintenance Utility Version 14.00.24225.1
>Copyright (C) Microsoft Corporation.  All rights reserved.
>
>"C:\Program Files (x86)\Microsoft Visual Studio 
>14.0\VC\bin\amd64\nmake.exe" depend && "C:\Program Files (x86)\Microsoft Visual >Studio 14.0\VC\bin\amd64\nmake.exe" _all
>
>Microsoft (R) Program Maintenance Utility Version 14.00.24225.1
>Copyright (C) Microsoft Corporation.  All rights reserved.
>
>
>Microsoft (R) Program Maintenance Utility Version 14.00.24225.1
>Copyright (C) Microsoft Corporation.  All rights reserved.
>
>cl  /I "." /I "crypto\include" /I "include" -DOPENSSL_USE_APPLINK -
>DDSO_WIN32 -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC >-DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOP
>ENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM ->DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM ->DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM "-DENGIN
>ESDIR=\"C:\\Program Files\\OpenSSL\\lib\\engines-1_1\"" "->DOPENSSLDIR=\"C:\\Program Files\\Common Files\\SSL\"" -W3 -wd4090 -Gs0 -GF -Gy ->nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D
>_CRT_SECURE_NO_DEPRECATE -DUNICODE -D_UNICODE /MD /O2 /Zi /Fdossl_static -c >/Focrypto\aes\aes_ige.obj "crypto\aes\aes_ige.c"
>aes_ige.c
>C:\Users\jget952\Downloads\openssl-1.1.0f\e_os.h(200): fatal error C1083: >Cannot >open include file: 'winsock2.h': No such file or directory
>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio >14.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'
>Stop.
>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio >14.0\VC\bin\amd64\nmake.exe"' : return code '0x2'
>Stop.
>
>C:\Users\jget952\Downloads\openssl-1.1.0f>

2 个答案:

答案 0 :(得分:6)

事实证明,因为我使用的是普通的命令提示符而不是visual studio命令提示符,所以nmake无法找到所需的所有库。

答案 1 :(得分:0)

您必须使用VC环境。您必须在Visual Studio安装中找到vcvarsall.bat

在安装了VS 2019和VC的情况下:

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
nmake