报错 Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable 的解决方案

cmake 从源码编译 grpc 的时候, 出现这个错误。

Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY...

系统是 Mac, 错误信息说需要设置系统变量。 尝试在 cmake 中加参数执行后,再 make,还是报错。 

cmake -DOPENSSL_ROOT_DIR=xxx ..

最后通过 export 设置环境变量解决问题。

 export OPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3/
 export OPENSSL_LIBRARIES=/opt/homebrew/opt/openssl@3/lib

cmake ..

make

扫描二维码关注公众号,回复: 14591697 查看本文章

另外, 编译 GRPC 时,遇到这个错误:

ld: warning: pointer not aligned at address xxx

CPU不支持 指针对齐,去掉这行代码的注释即可 grpc/src/grpc/third_party/nanopb/pb.h:

/* #define PB_NO_PACKED_STRUCTS 1 */

猜你喜欢

转载自blog.csdn.net/davidullua/article/details/126717060