Missing dependencies when building @com_google_protobuf//:protobuf_lite

Viewed 1749

When trying to build :protoc on OS X from https://github.com/google/protobuf/ (the 3.4.1 release) I get the following:

$ bazel build @com_google_protobuf//:protobuf_lite

ERROR: <...>/external/com_google_protobuf/BUILD:93:1: undeclared inclusion(s) in rule '@com_google_protobuf//:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/com_google_protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc':
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stddef.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/__stddef_max_align_t.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stdint.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/stdarg.h'
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include/limits.h'.
```

but, when building the target not as an external repo, it succeeds.

$ cd <...>/external/com_google_protobuf/
$ bazel build :protobuf_lite

The listed headers are system headers, so I'm missing something very obvious.

Any ideas?

2 Answers

FWIW I got this same error today after upgrading MacOS command line tools.

What worked for me was bazel clean --expunge. Without --expunge it didn't fix the issue.

Related