What version of protobuf and what language are you using?
Version: v3.5.2,v3.6.1,master(436139803ffbe0ca3dc0e563b63f29b2fd729d4f)
Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript
What operating system (Linux, Windows, ...) and version?
macOS 10.14.1
What runtime / compiler are you using (e.g., python version or gcc version)
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Build label: 0.19.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Nov 12 15:30:36 2018 (1542036636)
Build timestamp: 1542036636
Build timestamp as int: 1542036636
What did you do?
Steps to reproduce the behavior:
What did you expect to see
Building it successfully
What did you see instead?
The building failed with a few errors.
ERROR: /private/tmp/protobuf-3.5.2/BUILD:274:1: C++ compilation of rule '//:protoc_lib' failed (Exit 1) cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 36 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from src/google/protobuf/compiler/javanano/javanano_helpers.cc:38:
src/google/protobuf/compiler/javanano/javanano_helpers.h:57:37: error: unknown type name 'OneofDescriptor'
string UnderscoresToCamelCase(const OneofDescriptor* oneof);
^
src/google/protobuf/compiler/javanano/javanano_helpers.h:59:48: error: unknown type name 'OneofDescriptor'
string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof);
^
src/google/protobuf/compiler/javanano/javanano_helpers.h:188:32: error: no member named 'map_entry' in 'google::protobuf::MessageOptions'
return descriptor->options().map_entry() &&
~~~~~~~~~~~~~~~~~~~~~ ^
src/google/protobuf/compiler/javanano/javanano_helpers.h:189:27: error: no member named 'syntax' in 'google::protobuf::FileDescriptor'
descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3;
~~~~~~~~~~~~~~~~~~ ^
src/google/protobuf/compiler/javanano/javanano_helpers.h:189:55: error: no member named 'SYNTAX_PROTO3' in 'google::protobuf::FileDescriptor'
descriptor->file()->syntax() == FileDescriptor::SYNTAX_PROTO3;
~~~~~~~~~~~~~~~~^
src/google/protobuf/compiler/javanano/javanano_helpers.cc:157:37: error: unknown type name 'OneofDescriptor'
string UnderscoresToCamelCase(const OneofDescriptor* oneof) {
^
src/google/protobuf/compiler/javanano/javanano_helpers.cc:161:48: error: unknown type name 'OneofDescriptor'
string UnderscoresToCapitalizedCamelCase(const OneofDescriptor* oneof) {
^
7 errors generated.
Target //:protoc_lib failed to build
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment
More detail logs:
$ bazel build :protoc_lib --sandbox_debug
INFO: Analysed target //:protoc_lib (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/shuaiz/GitEnlistments/protobuf/BUILD:267:1: C++ compilation of rule '//:protoc_lib' failed (Exit 1) sandbox-exec failed: error executing command
(cd /private/var/tmp/_bazel_shuaiz/ae04e1f10b8f3926b76085f9860189fe/execroot/com_google_protobuf && \
exec env - \
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/shuaiz/Library/Python/2.7/bin \
PWD=/proc/self/cwd \
TMPDIR=/var/folders/hq/b0nns16s27787bqjkmbd0wnr0000gn/T/ \
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_shuaiz/ae04e1f10b8f3926b76085f9860189fe/sandbox/darwin-sandbox/4/sandbox.sb /private/var/tmp/_bazel_shuaiz/ae04e1f10b8f3926b76085f9860189fe/execroot/com_google_protobuf/_bin/process-wrapper '--timeout=0' '--kill_delay=15' external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/darwin-fastbuild/bin/_objs/protoc_lib/cpp_enum.pic.d '-frandom-seed=bazel-out/darwin-fastbuild/bin/_objs/protoc_lib/cpp_enum.pic.o' -fPIC -iquote . -iquote bazel-out/darwin-fastbuild/genfiles -iquote bazel-out/darwin-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/darwin-fastbuild/genfiles/external/bazel_tools -iquote bazel-out/darwin-fastbuild/bin/external/bazel_tools -isystem src -isystem bazel-out/darwin-fastbuild/genfiles/src -isystem bazel-out/darwin-fastbuild/bin/src -DHAVE_PTHREAD -Wall -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -Wno-writable-strings -Wno-write-strings -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/google/protobuf/compiler/cpp/cpp_enum.cc -o bazel-out/darwin-fastbuild/bin/_objs/protoc_lib/cpp_enum.pic.o)
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:159:20: error: redefinition of 'kint32max'
static const int32 kint32max = 0x7FFFFFFF;
^
/usr/local/include/google/protobuf/stubs/common.h:197:20: note: previous definition is here
static const int32 kint32max = 0x7FFFFFFF;
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:160:20: error: redefinition of 'kint32min'
static const int32 kint32min = -kint32max - 1;
^
/usr/local/include/google/protobuf/stubs/common.h:198:20: note: previous definition is here
static const int32 kint32min = -kint32max - 1;
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:161:20: error: redefinition of 'kint64max'
static const int64 kint64max = PROTOBUF_LONGLONG(0x7FFFFFFFFFFFFFFF);
^
/usr/local/include/google/protobuf/stubs/common.h:199:20: note: previous definition is here
static const int64 kint64max = GOOGLE_LONGLONG(0x7FFFFFFFFFFFFFFF);
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:162:20: error: redefinition of 'kint64min'
static const int64 kint64min = -kint64max - 1;
^
/usr/local/include/google/protobuf/stubs/common.h:200:20: note: previous definition is here
static const int64 kint64min = -kint64max - 1;
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:163:21: error: redefinition of 'kuint32max'
static const uint32 kuint32max = 0xFFFFFFFFu;
^
/usr/local/include/google/protobuf/stubs/common.h:201:21: note: previous definition is here
static const uint32 kuint32max = 0xFFFFFFFFu;
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
In file included from src/google/protobuf/stubs/macros.h:34:
src/google/protobuf/stubs/port.h:164:21: error: redefinition of 'kuint64max'
static const uint64 kuint64max = PROTOBUF_ULONGLONG(0xFFFFFFFFFFFFFFFF);
^
/usr/local/include/google/protobuf/stubs/common.h:202:21: note: previous definition is here
static const uint64 kuint64max = GOOGLE_ULONGLONG(0xFFFFFFFFFFFFFFFF);
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
In file included from src/google/protobuf/stubs/logging.h:34:
src/google/protobuf/stubs/macros.h:110:8: error: redefinition of 'CompileAssert'
struct CompileAssert {
^
/usr/local/include/google/protobuf/stubs/common.h:374:8: note: previous definition is here
struct CompileAssert {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
src/google/protobuf/stubs/logging.h:45:6: error: redefinition of 'LogLevel'
enum LogLevel {
^
/usr/local/include/google/protobuf/stubs/common.h:622:6: note: previous definition is here
enum LogLevel {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
src/google/protobuf/stubs/logging.h:75:23: error: redefinition of 'LogMessage'
class PROTOBUF_EXPORT LogMessage {
^
/usr/local/include/google/protobuf/stubs/common.h:647:26: note: previous definition is here
class LIBPROTOBUF_EXPORT LogMessage {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
src/google/protobuf/stubs/logging.h:107:23: error: redefinition of 'LogFinisher'
class PROTOBUF_EXPORT LogFinisher {
^
/usr/local/include/google/protobuf/stubs/common.h:673:26: note: previous definition is here
class LIBPROTOBUF_EXPORT LogFinisher {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
src/google/protobuf/stubs/logging.h:165:4: error: redefinition of 'CheckNotNull'
T* CheckNotNull(const char* /* file */, int /* line */,
^
/usr/local/include/google/protobuf/stubs/common.h:723:4: note: previous definition is here
T* CheckNotNull(const char *file, int line, const char *name, T* val) {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:44:
In file included from src/google/protobuf/compiler/scc.h:36:
src/google/protobuf/stubs/logging.h:230:23: error: redefinition of 'LogSilencer'
class PROTOBUF_EXPORT LogSilencer {
^
/usr/local/include/google/protobuf/stubs/common.h:784:26: note: previous definition is here
class LIBPROTOBUF_EXPORT LogSilencer {
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
In file included from src/google/protobuf/compiler/cpp/cpp_helpers.h:50:
In file included from src/google/protobuf/stubs/strutil.h:39:
In file included from src/google/protobuf/stubs/stringpiece.h:154:
src/google/protobuf/port_def.inc:74:2: error: PROTOBUF_DEPRECATED was previously defined
#error PROTOBUF_DEPRECATED was previously defined
^
In file included from src/google/protobuf/compiler/cpp/cpp_enum.cc:38:
src/google/protobuf/compiler/cpp/cpp_helpers.h:252:27: error: no member named 'syntax' in 'google::protobuf::FileDescriptor'
return message->file()->syntax() != FileDescriptor::SYNTAX_PROTO3;
~~~~~~~~~~~~~~~ ^
src/google/protobuf/compiler/cpp/cpp_helpers.h:252:55: error: no member named 'SYNTAX_PROTO3' in 'google::protobuf::FileDescriptor'
return message->file()->syntax() != FileDescriptor::SYNTAX_PROTO3;
~~~~~~~~~~~~~~~~^
src/google/protobuf/compiler/cpp/cpp_helpers.h:371:32: error: no member named 'map_entry' in 'google::protobuf::MessageOptions'
return descriptor->options().map_entry();
~~~~~~~~~~~~~~~~~~~~~ ^
src/google/protobuf/compiler/cpp/cpp_helpers.h:380:16: error: no member named 'syntax' in 'google::protobuf::FileDescriptor'
return file->syntax() != FileDescriptor::SYNTAX_PROTO3;
~~~~ ^
src/google/protobuf/compiler/cpp/cpp_helpers.h:380:44: error: no member named 'SYNTAX_PROTO3' in 'google::protobuf::FileDescriptor'
return file->syntax() != FileDescriptor::SYNTAX_PROTO3;
~~~~~~~~~~~~~~~~^
src/google/protobuf/compiler/cpp/cpp_helpers.h:386:16: error: no member named 'syntax' in 'google::protobuf::FileDescriptor'
return file->syntax() == FileDescriptor::SYNTAX_PROTO3;
~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Target //:protoc_lib failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.977s, Critical Path: 0.78s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
INFO: 0 processes.
FAILED: Build did NOT complete successfully
Cannot reproduce it on another mac machine. I think there was a deeper cause for this issue.
@hcoona I think the problem is that you have some local protobuf headers in ./src/google/protobuf/... conflicting with global headers in /usr/local/include.
Deleting /usr/local/Cellar/protobuf directory resolved a similar issue for me.
Expanding on the useful tip from @mennanov, here's the commands that I used:
$ brew uses protobuf --installed
protobuf formula from your system:$ brew uninstall protobuf
I believe that this formula is routinely installed for use of the protoc tool, in case you're trying to remember why you installed it in the first place.
Deleting
/usr/local/Cellar/protobufdirectory resolved a similar issue for me.
This works for me.
Thanks!
Most helpful comment
Deleting
/usr/local/Cellar/protobufdirectory resolved a similar issue for me.