环境安装
·MinGW
下载MinGW并安装,添加bin路径到环境变量path中,重命名mingw32-make.exe为make.exe。
·CMake
下载CMake并安装,添加bin路径到环境变量path中,输入cmake --version,验证cmake是否安装成功。
·GRPC
使用git下载GRPC,下载包含gRPC依赖项源代码的子模块
>git clone -b v1.29.1 https://github.com/grpc/grpc.git
>git submodule update --init
安装nasm到C:/Program Files (x86)/NASM/(required by boringssl)
编译win32版本:
mkdir build_MinGW_x32
cd build_MinGW_x32\
cmake -G"MinGW Makefiles" -D"CMAKE_MAKE_PROGRAM:PATH=C:/MinGW/bin/make.exe" -D"CMAKE_ASM_NASM_COMPILER:PATH=C:/Program Files (x86)/NASM/nasm.exe" ..
make
错误处理
1、未安装nasm
现象描述:安装boringss时提示未指定CMAKE_ASM_NASM_COMPILER
解决方案:安装nasm
2、'once_flag在命名空间’std‘未命名
方案:升级MinGW
参考:https://www.it1352.com/494519.html
3、不支持std::thread
解决方案:更换编译器为更高阶版本,升级MinGW
参考:https://blog.csdn.net/qq_34719188/article/details/84193649
4、 _WIN32_WINNT not defined
解决方案:在CMakeLists.txt中增加定义
参考:https://github.com/grpc/grpc/issues/18928
5、chacha-x86.asm::error:instruction not supported in 64-bit mode
参考资料
https://blog.csdn.net/danxingxian_go/article/details/104176878