交叉编译GRPC遇到的问题

交叉编译GRPC遇到的问题:

1._gRPC_CPP_PLUGIN-NOTFOUND: program not found or is not executable

不能直接开始编译,需要先编译编译机环境可执行的protoc和grpc-cpp-plugin

you will first need to build protoc and grpc_cpp_plugin for the host architecture. These tools are used during the build of gRPC, so we need copies of executables that can be run natively.

2.C++: Undefine reference to functions defined in absl::lts_

引用:C++: Undefine reference to functions defined in `absl::lts_20230125` · Issue #12292 · protocolbuffers/protobuf · GitHub

I believe the issue is that something like find_package(protobuf REQUIRED) uses the embedded FindProtobuf package from CMake:

FindProtobuf — CMake 3.28.0-rc2 Documentation

This package has not been updated to know about the Abseil dependency. One needs to use:

find_package(protobuf REQUIRED CONFIG)

大致意思是find_package时使用的Findxxx.cmake不正确导致无法找到对应的静态库文件。配置成

find_package(protobuf CONFIG REQUIRED)问题完美解决。

教训:其实从官网clone下来的代码中BUILDING.md中写的很清楚,我们只需要按照步骤去执行一般不会出错。大部分错误都是我们自己一上来就按照自己下想法一通乱操作导致的。

例如在https://github.com/grpc/grpc/blob/master/BUILDING.md中有专门一段实例教我们怎么进行交叉编译:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值