gpt4 book ai didi

build - 无法在容器内构建 grpc v1.28.1

转载 作者:行者123 更新时间:2023-12-04 09:45:58 26 4
gpt4 key购买 nike

我在尝试在容器内构建 grpc 时收到 c++: fatal 错误。在三台不同的机器上尝试使用 GNU CC 7 和 10,所有机器都运行 Docker Desktop for Windows。

基本的 Dockerfile 模仿 grpc 构建文档:

FROM gcc:10.1.0

RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential autoconf libtool pkg-config git curl cmake

RUN cd /tmp && \
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc && \
cd grpc && \
git submodule update --init && \
mkdir -p cmake/build && \
mkdir -p /opt/grpc && \
cd cmake/build && \
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/opt/grpc ../.. && \
make -j && \
make install

但无法在所有系统上成功构建,我明白了:

c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc.dir/build.make:2130: CMakeFiles/grpc.dir/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc_cronet.dir/build.make:2182: CMakeFiles/grpc_cronet.dir/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** Waiting for unfinished jobs....
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc.dir/build.make:2182: CMakeFiles/grpc.dir/src/core/ext/transport/chttp2/transport/chttp2_transport.cc.o] Error 1
make[2]: *** [CMakeFiles/grpc_cronet.dir/build.make:2598: CMakeFiles/grpc_cronet.dir/src/core/ext/filters/client_channel/client_channel.cc.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc_unsecure.dir/build.make:2208: CMakeFiles/grpc_unsecure.dir/src/core/ext/transport/chttp2/transport/chttp2_transport.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/grpc_cronet.dir/build.make:2819: CMakeFiles/grpc_cronet.dir/src/core/ext/filters/client_channel/resolving_lb_policy.cc.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc.dir/build.make:2520: CMakeFiles/grpc.dir/src/core/lib/security/context/security_context.cc.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[ 89%] Building C object CMakeFiles/grpc.dir/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c.o
make[2]: *** [CMakeFiles/grpc.dir/build.make:2546: CMakeFiles/grpc.dir/src/core/lib/security/credentials/composite/composite_credentials.cc.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/grpc_unsecure.dir/build.make:2858: CMakeFiles/grpc_unsecure.dir/src/core/ext/filters/client_channel/resolving_lb_policy.cc.o] Error 1
make[2]: *** [CMakeFiles/grpc_cronet.dir/build.make:2234: CMakeFiles/grpc_cronet.dir/src/core/ext/transport/chttp2/transport/chttp2_transport.cc.o] Error 1
...

终止发生在构建的不同阶段。任何想法是什么终止了编译器?

最佳答案

啊哈,失败是由内存限制引起的;不带参数的 make -j 对于 Windows 来说过于激进。将其限制为给定值即可解决问题。

关于build - 无法在容器内构建 grpc v1.28.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62107520/

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