Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing dependencies when building @com_google_protobuf//:protobuf_lite

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?

like image 662
user1071136 Avatar asked Mar 07 '23 21:03

user1071136


2 Answers

From https://github.com/bazelbuild/bazel/issues/2852#issuecomment-295747929 :

Setting BAZEL_SH=/bin/bash resolves the issue.

like image 98
user1071136 Avatar answered Apr 27 '23 17:04

user1071136


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.

like image 39
Justin L. Avatar answered Apr 27 '23 18:04

Justin L.