Grpc: No such file or directory #include <google/protobuf/compiler/code_generator.h>

Created on 6 Sep 2017  Ā·  3Comments  Ā·  Source: grpc/grpc

What version of gRPC and what language are you using?

Not sure. The readme on master only says 1.0. Perhaps add instructions here on where to find exact version?

What operating system (Linux, Windows, …) and version?

Ubuntu 17.04

What runtime / compiler are you using (e.g. python version or version of gcc)

gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406

What did you do?

 $ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
 $ cd grpc
 $ git submodule update --init
 $ make

What did you expect to see?

Expected make to complete successfully.

What did you see instead?

At the point of running make, the following error occurred:

āÆ make
[MAKE]    Generating cache.mk
[HOSTCXX] Compiling src/compiler/cpp_generator.cc
In file included from ./src/compiler/cpp_generator.h:29:0,
                 from src/compiler/cpp_generator.cc:21:
./src/compiler/config.h:25:53: fatal error: google/protobuf/compiler/code_generator.h: No such file or directory
 #include <google/protobuf/compiler/code_generator.h>
                                                     ^
compilation terminated.
Makefile:2525: recipe for target '/home/anton/git/grpc/objs/opt/src/compiler/cpp_generator.o' failed
make: *** [/home/anton/git/grpc/objs/opt/src/compiler/cpp_generator.o] Error 1

When running make --debug:

make --debug
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
 File 'all' does not exist.
   File 'static' does not exist.
     File 'static_c' does not exist.
       File 'pc_c' does not exist.
      Must remake target 'pc_c'.
      Successfully remade target file 'pc_c'.
       File 'pc_c_unsecure' does not exist.
      Must remake target 'pc_c_unsecure'.
      Successfully remade target file 'pc_c_unsecure'.
      Target 'cache.mk' is double-colon and has no prerequisites.
      Must remake target 'cache.mk'.
[MAKE]    Generating cache.mk
      Successfully remade target file 'cache.mk'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/http/httpcli_security_connector.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/context/security_context.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/composite/composite_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/credentials_metadata.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/fake/fake_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/google_default/credentials_generic.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/google_default/google_default_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/iam/iam_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/jwt/json_token.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/jwt/jwt_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/jwt/jwt_verifier.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/oauth2/oauth2_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/plugin/plugin_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/credentials/ssl/ssl_credentials.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/client_auth_filter.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/lb_targets_info.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/secure_endpoint.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/security_connector.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/security_handshaker.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/server_auth_filter.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/transport/tsi_error.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/security/util/json_util.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/lib/surface/init_secure.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/fake_transport_security.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/gts_transport_security.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/ssl_transport_security.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/transport_security_grpc.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/transport_security.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/tsi/transport_security_adapter.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/transport/chttp2/client/secure/secure_channel_create.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/plugin_registry/grpc_plugin_registry.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/transport/cronet/transport/cronet_api_dummy.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/ext/transport/cronet/transport/cronet_transport.c'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/core/plugin_registry/grpc_cronet_plugin_registry.c'.
    Must remake target 'static_c'.
    Successfully remade target file 'static_c'.
     File 'static_cxx' does not exist.
       File 'pc_cxx' does not exist.
      Must remake target 'pc_cxx'.
      Successfully remade target file 'pc_cxx'.
       File 'pc_cxx_unsecure' does not exist.
      Must remake target 'pc_cxx_unsecure'.
      Successfully remade target file 'pc_cxx_unsecure'.
       File '/home/anton/git/grpc/libs/opt/libgrpc++.a' does not exist.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/client/secure_credentials.cc'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/common/auth_property_iterator.cc'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/common/secure_auth_context.cc'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/common/secure_channel_arguments.cc'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/common/secure_create_auth_context.cc'.
           Prerequisite '/home/anton/git/grpc/libs/opt/libboringssl.a' is newer than target 'src/cpp/server/secure_server_credentials.cc'.
         File '/home/anton/git/grpc/objs/opt/src/cpp/codegen/codegen_init.o' does not exist.
           File '/home/anton/git/grpc/gens/src/proto/grpc/health/v1/health.pb.cc' does not exist.
             File '/home/anton/git/grpc/bins/opt/grpc_cpp_plugin' does not exist.
               File '/home/anton/git/grpc/objs/opt/src/compiler/cpp_plugin.o' does not exist.
                 File '/home/anton/git/grpc/libs/opt/libgrpc_plugin_support.a' does not exist.
                   File '/home/anton/git/grpc/objs/opt/src/compiler/cpp_generator.o' does not exist.
                  Must remake target '/home/anton/git/grpc/objs/opt/src/compiler/cpp_generator.o'.
[HOSTCXX] Compiling src/compiler/cpp_generator.cc
In file included from ./src/compiler/cpp_generator.h:29:0,
                 from src/compiler/cpp_generator.cc:21:
./src/compiler/config.h:25:53: fatal error: google/protobuf/compiler/code_generator.h: No such file or directory
 #include <google/protobuf/compiler/code_generator.h>
                                                     ^
compilation terminated.
Makefile:2525: recipe for target '/home/anton/git/grpc/objs/opt/src/compiler/cpp_generator.o' failed

Anything else we should know about your project / environment?

Most helpful comment

make HAS_SYSTEM_PROTOBUF=false resolved issue.

All 3 comments

The original error is resolved by running sudo apt-get install libprotoc-dev. I now get further but now get:

[HOSTCXX] Compiling src/compiler/php_generator.cc
In file included from src/compiler/php_generator.cc:23:0:
./src/compiler/php_generator_helpers.h: In function ā€˜grpc::string grpc_php_generator::GetPHPServiceFilename(const FileDescriptor*, const ServiceDescriptor*, const string&)’:
./src/compiler/php_generator_helpers.h:51:23: error: ā€˜const class google::protobuf::FileOptions’ has no member named ā€˜has_php_namespace’; did you mean ā€˜has_csharp_namespace’?
   if (file->options().has_php_namespace()) {
                       ^~~~~~~~~~~~~~~~~
./src/compiler/php_generator_helpers.h:52:39: error: ā€˜const class google::protobuf::FileOptions’ has no member named ā€˜php_namespace’; did you mean ā€˜csharp_namespace’?
     oss << ReplaceAll(file->options().php_namespace(), "\\", "/");
                                       ^~~~~~~~~~~~~
src/compiler/php_generator.cc: In function ā€˜grpc::string grpc_php_generator::GenerateFile(const FileDescriptor*, const ServiceDescriptor*, const string&)’:
src/compiler/php_generator.cc:153:25: error: ā€˜const class google::protobuf::FileOptions’ has no member named ā€˜has_php_namespace’; did you mean ā€˜has_csharp_namespace’?
     if (file->options().has_php_namespace()) {
                         ^~~~~~~~~~~~~~~~~
src/compiler/php_generator.cc:154:39: error: ā€˜const class google::protobuf::FileOptions’ has no member named ā€˜php_namespace’; did you mean ā€˜csharp_namespace’?
       php_namespace = file->options().php_namespace();
                                       ^~~~~~~~~~~~~
Makefile:2525: recipe for target '/home/anton/git/grpc/objs/opt/src/compiler/php_generator.o' failed
make: *** [/home/anton/git/grpc/objs/opt/src/compiler/php_generator.o] Error 1

make HAS_SYSTEM_PROTOBUF=false resolved issue.

sudo make HAS_SYSTEM_PROTOBUF=false

Was this page helpful?
0 / 5 - 0 ratings