grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.49k stars 764 forks source link

building a plugin with a dependency error #1141

Open EmptyShadow opened 2 years ago

EmptyShadow commented 2 years ago

the plugin assembly fails with an error

ARG ALPINE_VERSION=3.14.1

FROM alpine:${ALPINE_VERSION} AS cpp
RUN apk update && apk add --no-cache git curl build-base autoconf automake libtool cmake linux-headers

FROM cpp AS grpc-web
ARG GRPC_WEB_VERSION=1.2.1
RUN cd /tmp \
    && git clone --depth 1 --branch ${GRPC_WEB_VERSION} https://github.com/grpc/grpc-web \
    && cd grpc-web \
    && git submodule update --init --recursive
RUN cd /tmp/grpc-web \
    && make install-plugin -j 4
+] Building 0.4s (7/7) FINISHED                                                                     
 => [internal] load build definition from Dockerfile                                            0.0s
 => => transferring dockerfile: 2.18kB                                                          0.0s
 => [internal] load .dockerignore                                                               0.0s
 => => transferring context: 34B                                                                0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14.1                                0.0s
 => [cpp 1/2] FROM docker.io/library/alpine:3.14.1                                              0.0s
 => CACHED [cpp 2/2] RUN apk update && apk add --no-cache git curl build-base autoconf automak  0.0s
 => CACHED [grpc-web 1/2] RUN cd /tmp     && git clone --depth 1 --branch 1.2.1 https://github  0.0s
 => ERROR [grpc-web 2/2] RUN cd /tmp/grpc-web     && make plugin -j 4     && make install-plug  0.4s
------                                                                                               
 > [grpc-web 2/2] RUN cd /tmp/grpc-web     && make plugin -j 4     && make install-plugin -j 4:
#7 0.337 cd "/tmp/grpc-web"/javascript/net/grpc/web && make
#7 0.338 make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
#7 0.340 make[1]: Entering directory '/tmp/grpc-web/javascript/net/grpc/web'
#7 0.340 g++ -std=c++11 -I/usr/local/include -pthread  -c -o grpc_generator.o grpc_generator.cc
#7 0.354 grpc_generator.cc:19:10: fatal error: google/protobuf/compiler/code_generator.h: No such file or directory
#7 0.354    19 | #include <google/protobuf/compiler/code_generator.h>
#7 0.354       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#7 0.354 compilation terminated.
#7 0.358 make[1]: *** [<builtin>: grpc_generator.o] Error 1
#7 0.358 make[1]: Leaving directory '/tmp/grpc-web/javascript/net/grpc/web'
#7 0.358 make: *** [Makefile:102: plugin] Error 2
------
executor failed running [/bin/sh -c cd /tmp/grpc-web     && make plugin -j 4     && make install-plugin -j 4]: exit code: 2
sampajano commented 2 years ago

Hi :)

I think you might be missing a few steps/deps before running make. Please refer to this Dockerfile to build the plugin using Makefile (also note that after 1.2.1 we've refactored our dependencies to use third_party/protobuf directly, instead of third_party/grpc/third_party/protobuf).

(Also just curious what's the reason you need to build the plugin from scratch? :))