gpt4 book ai didi

C++ 在抛出 'std::system_error' 实例后调用终止

转载 作者:行者123 更新时间:2023-11-27 23:42:17 37 4
gpt4 key购买 nike

最近我开始研究 Grpc。在 Grpc C++ 编译中出现以下错误,不确定是什么导致了这个问题。

我不是 C++ 背景,任何帮助对我来说都会非常有用。

[HOSTLD] 链接/home/test/grpc/bins/opt/grpc_ruby_plugin[PROTOC] 从 src/proto/grpc/channelz/channelz.proto 生成 protobuf CC 文件[GRPC] 从中生成 gRPC 的 protobuf 服务 CC 文件src/proto/grpc/channelz/channelz.proto

在抛出“std::system_error”实例后调用终止

what(): 未知错误-1

--grpc_out:protoc-gen-grpc:插件被信号 6 杀死。

make: *** [/home/test/grpc/gens/src/proto/grpc/channelz/channelz.grpc.pb.cc] 错误1

在我尝试交叉编译之前,这导致了 helloworld 通信中的“grpc 段错误”。为了明确我已按照以下步骤操作。

我核对了我的/usr/local/lib/并清除了所有 proto 和 grpc 库

rm -f/usr/local/lib/libproto*/usr/local/lib/libgrpc*

清理一切

git submodule foreach git clean -xfd

git clean -xfd

然后重新安装所有东西,但仍然出现上述错误。有人可以帮我解决这个问题吗?

注意:我删除了完整的 grpc 文件夹,重新克隆了它。安装了 protobuf 并且 protobuf 安装成功,但是当我在 gRPC 中给出“make”命令时,出现上述错误。

当我用谷歌搜索时,这看起来是 C++ 方面的一些一般性错误。

以下是我遵循的步骤:

• git clone -b $(curl -L http://grpc.io/release ) https://github.com/grpc/grpc

• cd grpc

• git 子模块更新 --init

• cd third_party/protobuf

• ./Autogen.sh

• ./配置

• make && make install(Protobuf安装成功)

• 转到 grpc 文件夹并提供 make。

这不成功,在抛出 'std::system_error' 实例后调用 throws terminate

最佳答案

我得到了解决方案,这是因为 pthread 没有正确配置。

从 protobuf 文件夹执行以下命令解决了问题。

pkg-config --cflags protobuf# 打印编译器标志

pkg-config --libs protobuf# 打印链接器标志

pkg-config --cflags --libs protobuf# 打印两者

./configure CXXFLAGS="$(pkg-config --cflags protobuf)"LIBS="$(pkg-config --libs protobuf)"

制作

[sudo] 进行安装

进入grpc文件夹并运行make命令。

关于C++ 在抛出 'std::system_error' 实例后调用终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53586540/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com