Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fail with error 'google/protobuf/stubs/common.h' file not found #1116

Closed
coreych opened this issue Mar 5, 2017 · 10 comments
Assignees

Comments

@coreych
Copy link

@coreych coreych commented Mar 5, 2017

https://github.com/tensorflow/models/tree/master/syntaxnet

The following command threw an error on Mac OS X during build.

bazel test --linkopt=-headerpad_max_install_names
syntaxnet/... util/utf8/...

ERROR: /private/var/tmp/_bazel_coreychong/12e1cac900a5b57469553695a912bfcb/external/org_tensorflow/tensorflow/contrib/ffmpeg/BUILD:36:1: C++ compilation of rule '@org_tensorflow//tensorflow/contrib/ffmpeg:encode_audio_op_cc' failed: cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 -DNDEBUG ... (remaining 47 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from external/org_tensorflow/tensorflow/contrib/ffmpeg/encode_audio_op.cc:18:
In file included from external/org_tensorflow/tensorflow/contrib/ffmpeg/ffmpeg_lib.h:22:
In file included from external/org_tensorflow/tensorflow/core/lib/core/status.h:22:
bazel-out/host/genfiles/external/org_tensorflow/tensorflow/core/lib/core/error_codes.pb.h:9:10: fatal error: 'google/protobuf/stubs/common.h' file not found
#include <google/protobuf/stubs/common.h>
^
1 error generated.
INFO: Elapsed time: 7.281s, Critical Path: 4.35s
//syntaxnet:arc_standard_transitions_test NO STATUS
//syntaxnet:binary_segment_state_test NO STATUS
//syntaxnet:binary_segment_transitions_test NO STATUS
//syntaxnet:char_properties_test NO STATUS
//syntaxnet:graph_builder_test NO STATUS
//syntaxnet:lexicon_builder_test NO STATUS
//syntaxnet:morphology_label_set_test NO STATUS
//syntaxnet:parser_features_test NO STATUS
//syntaxnet:parser_trainer_test NO STATUS
//syntaxnet:reader_ops_test NO STATUS
//syntaxnet:segmenter_utils_test NO STATUS
//syntaxnet:sentence_features_test NO STATUS
//syntaxnet:shared_store_test NO STATUS
//syntaxnet:tagger_transitions_test NO STATUS
//syntaxnet:text_formats_test NO STATUS
//util/utf8:unicodetext_unittest NO STATUS

Executed 0 out of 17 tests: 1 fails to build and 16 were skipped.

Protobuf version ==3.0.0b2 followed setup instructions and Bazel version 0.4.3.
Anyone encountered this error before?

@bakarov

This comment has been minimized.

Copy link

@bakarov bakarov commented Mar 6, 2017

Problem with common.h can be fixed by installing protobuf-dev package, e.g. for Ubuntu:

sudo apt-get install libprotobuf-dev protobuf-compiler

But then I'm getting another error:

fatal error: google/protobuf/arena.h: No such file or directory compilation terminated.

People say that it can be caused by the outdated version of protobuf, but I have the latest version 3.0.0b2.

@prb12

This comment has been minimized.

Copy link
Member

@prb12 prb12 commented Mar 6, 2017

@calberti I was assuming this was a generic TF installation problem, but then noticed you have detailed instructions in your README.md including how to install protobuf. Is it possible these are now out of date?

@coreych

This comment has been minimized.

Copy link
Author

@coreych coreych commented Mar 7, 2017

It worked! Executed 16 out of 17 tests: 17 tests pass.

Instead of following setup instructions using pip and version 3.0.0b2.
All i did was

brew install protobuf

In home-brew, protobuf==3.2.0

Not sure if I should remove the previous 3.0.0b2 installed using pip?

@ankanch

This comment has been minimized.

Copy link

@ankanch ankanch commented Sep 13, 2017

I have the same issue,
Build FAILED.

"D:\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"D:\caffe2\build\caffe2\Caffe2_CPU.vcxproj" (default target) (3) ->
"D:\caffe2\build\caffe2\proto\Caffe2_PROTO.vcxproj" (default target) (4) ->
(ClCompile target) ->
D:\caffe2\build\caffe2/proto/prof_dag.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': N
o such file or directory (compiling source file D:\caffe2\build\caffe2\proto\prof_dag.pb.cc) [D:\caffe2\build\caffe2\proto\Caffe2
_PROTO.vcxproj]
D:\caffe2\build\caffe2/proto/caffe2_legacy.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.
h': No such file or directory (compiling source file D:\caffe2\build\caffe2\proto\caffe2_legacy.pb.cc) [D:\caffe2\build\caffe2\pr
oto\Caffe2_PROTO.vcxproj]
D:\caffe2\build\caffe2/proto/predictor_consts.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/comm
on.h': No such file or directory (compiling source file D:\caffe2\build\caffe2\proto\predictor_consts.pb.cc) [D:\caffe2\build\caf
fe2\proto\Caffe2_PROTO.vcxproj]
D:\caffe2\build\caffe2/proto/hsm.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No suc
h file or directory (compiling source file D:\caffe2\build\caffe2\proto\hsm.pb.cc) [D:\caffe2\build\caffe2\proto\Caffe2_PROTO.vcx
proj]
D:\caffe2\build\caffe2/proto/caffe2.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No
such file or directory (compiling source file D:\caffe2\build\caffe2\proto\caffe2.pb.cc) [D:\caffe2\build\caffe2\proto\Caffe2_PRO
TO.vcxproj]
D:\caffe2\build\caffe2/proto/metanet.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No
such file or directory (compiling source file D:\caffe2\build\caffe2\proto\metanet.pb.cc) [D:\caffe2\build\caffe2\proto\Caffe2_P
ROTO.vcxproj]

"D:\caffe2\build\ALL_BUILD.vcxproj" (default target) (1) ->
"D:\caffe2\build\caffe2\Caffe2_CPU.vcxproj" (default target) (3) ->
"D:\caffe2\build\caffe\proto\Caffe_PROTO.vcxproj" (default target) (5) ->
D:\caffe2\build\caffe/proto/caffe.pb.h(9): fatal error C1083: Cannot open include file: 'google/protobuf/stubs/common.h': No su
ch file or directory [D:\caffe2\build\caffe\proto\Caffe_PROTO.vcxproj]

0 Warning(s)
7 Error(s)
@OLGKAD

This comment has been minimized.

Copy link

@OLGKAD OLGKAD commented Oct 19, 2017

@bakarov, I'm having exactly the same problem. I would highly appreciate it, if you could share with us how you resolved it.

@mmazloum

This comment has been minimized.

Copy link

@mmazloum mmazloum commented Jan 17, 2018

same here with protobuf 3.5.1 on XCode for a basic C++ project. The compiler asks to turn angles into quotes but this turns out to spread further similar errors on all protobuf other includes

@itsmeolivia

This comment has been minimized.

Copy link
Contributor

@itsmeolivia itsmeolivia commented Feb 8, 2018

I apologize but I am having a hard time understanding what the problem is, where the problem is, and what version it affects. Please resubmit and pay attention to the issue template (https://github.com/tensorflow/tensorflow/issues/new) . Please provide all the information it asks. Thank you.

@mmazloum

This comment has been minimized.

Copy link

@mmazloum mmazloum commented Feb 8, 2018

@itsmeolivia I added a comment on this issue because I had the same problem but it's not related to tensorflow directly.

The issue is that the XCode IDE (Mac OS users only) won't link with the protocolbuffer library, so any header file like the ones suggested above ( 'google/protobuf/stubs/common.h') included in a XCode project won't compile.

Feel free to ask if you need more info.

@karmel

This comment has been minimized.

Copy link
Member

@karmel karmel commented Feb 22, 2018

It sounds like this is an XCode/protobuf issue. This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!

@ranka47

This comment has been minimized.

Copy link

@ranka47 ranka47 commented May 30, 2018

Hi
OS: Ubuntu 16.04
Tensorflow Version: Branch r1.8

I am compiling a C++ file using the following command:

g++ -std=c++11 validation.cpp -L./ -ltensorflow_cc -o validation -I/home/hadoop/git/tensorflow-r1.8/ -I/home/hadoop/git/eigen3/ -I/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/

To come to this step:

  1. First I built the libtensorflow_cc.so using bazel build //tensorflow:libtensorflow_cc.so
  2. Then I copied the .so file to the project directory:
    cp bazel-bin/tensorflow/libtensorflow_cc.so ~/projects/tf-vad-validation/.
  3. Included the cloned folder of branch r1.8 and the bazel-genfiles for including some missing header files like const_op.h
  4. Cloned and included the eigen3 folder because the compiler went into deep nested loop while importing unsupported/Eigen/CXX11/Tensor

After this I am getting the error:
bazel-genfiles/tensorflow/core/lib/core/error_codes.pb.h:9:42: fatal error: google/protobuf/stubs/common.h: No such file or directory

After that, I downloaded the protobuf 2.6.1 and compiled it. I included the library libprotobuf.so and the header files using the following commands:

g++ -std=c++11 validation.cpp -L./ -ltensorflow_cc -lprotobuf -o validation -I/home/hadoop/git/tensorflow-r1.8/ -I/home/hadoop/git/eigen3/ -I/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/ -I/home/hadoop/git/protobuf/include

After this I am getting the following error:

In file included from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/lib/core/status.h:23:0,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/framework/variant.h:29,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/framework/allocator.h:26,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/framework/tensor.h:20,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/framework/ops.h:21,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/ops/const_op.h:19,
                 from validation.cpp:41:
/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/lib/core/error_codes.pb.h:115:104: error: expected class-name before ‘{’ token
 template <> struct is_proto_enum< ::tensorflow::error::Code> : ::google::protobuf::internal::true_type {};
                                                                                                        ^
In file included from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/framework/tensor_shape.h:22:0,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/core/framework/tensor.h:21,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/framework/ops.h:21,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/ops/const_op.h:19,
                 from validation.cpp:41:
/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/types.pb.h:140:101: error: expected class-name before ‘{’ token
 template <> struct is_proto_enum< ::tensorflow::DataType> : ::google::protobuf::internal::true_type {};
                                                                                                     ^
In file included from /home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/tensor.pb.h:32:0,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/framework/ops.h:22,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/ops/const_op.h:19,
                 from validation.cpp:41:
/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/resource_handle.pb.h:105:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
In file included from /home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/tensor.pb.h:33:0,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/framework/ops.h:22,
                 from /home/hadoop/git/tensorflow-r1.8/tensorflow/cc/ops/const_op.h:19,
                 from validation.cpp:41:
/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/tensor_shape.pb.h:112:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
          ^
/home/hadoop/git/tensorflow-r1.8/bazel-genfiles/tensorflow/core/framework/tensor_shape.pb.h:254:10: error: ‘PROTOBUF_CONSTEXPR’ does not name a type
   static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =

Can you please help me out with it?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.