【问题标题】:Compile gRPC with OpenSSL on Windows在 Windows 上使用 OpenSSL 编译 gRPC
【发布时间】:2022-01-13 14:10:55
【问题描述】:

我已在 Windows 上的标准位置 (C:\Program Files\OpenSSL) 编译和安装 OpenSSL,这是我用于编译 gRPC 的 build.bat 文件:

setlocal
@call  "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"

if not exist build mkdir build2
if not exist install mkdir install
rmdir /S /Q dist
mkdir dist

cmake . -B build2 -A x64 -DCMAKE_INSTALL_PREFIX=install -DgRPC_SSL_PROVIDER=package
if %ERRORLEVEL% NEQ 0 EXIT /B 1

cmake --build build2 --config Release
if %ERRORLEVEL% NEQ 0 EXIT /B 1

cmake --install build2
if %ERRORLEVEL% NEQ 0 EXIT /B 1

tar -C install -czf dist/gRPC.tar.gz .
if %ERRORLEVEL% NEQ 0 EXIT /B 1

但是,这似乎不起作用,因为 CMake 找不到 OpenSSL 标头:

...
C:\Users\atran\Desktop\source_code\grpc\src/core/tsi/ssl_transport_security.h(24,10): fatal error C1083: Canno
t open include file: 'openssl/x509.h': No such file or directory [C:\Users\atran\Desktop\source_code\grpc\buil
d2\grpc.vcxproj]
  xds_cluster_impl.cc
C:\Users\atran\Desktop\source_code\grpc\third_party\upb\upb/table_internal.h(200,28): warning C4334: '<<': res
ult of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\Users\atran\Desktop\sourc
e_code\grpc\build2\grpc.vcxproj]
C:\Users\atran\Desktop\source_code\grpc\third_party\upb\upb/msg_internal.h(469,40): warning C4334: '<<': resul 
t of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) [C:\Users\atran\Desktop\source_ 
code\grpc\build2\grpc.vcxproj]
C:\Users\atran\Desktop\source_code\grpc\src/core/tsi/ssl_transport_security.h(24,10): fatal error C1083: Canno
t open include file: 'openssl/x509.h': No such file or directory [C:\Users\atran\Desktop\source_code\grpc\buil
d2\grpc.vcxproj]
...

有什么建议吗?

【问题讨论】:

  • 感觉你的 OpenSSL 安装错过了标题 openssl/x509.h。它可能太旧了。

标签: c++ cmake openssl grpc


【解决方案1】:

抱歉,问题是因为我忘记在干净的目录上执行 CMake,因此之前尝试的许多 CMake 工件都进入了这个目录。

【讨论】:

    猜你喜欢
    • 2011-03-15
    • 2017-02-21
    • 1970-01-01
    • 2014-10-08
    • 1970-01-01
    • 2016-04-17
    • 2018-04-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多