bazel: Missing dependency declarations for the following files included by X
Description of the problem / feature request:
Bazel is virtually unusable because of the constant “missing dependency declarations for the following files included by X” messages. This not only gets in the way of our own development, I can’t even compile some “official” rules such as rules_sass
.
Easiest way to reproduce
$ git clone https://github.com/bazelbuild/rules_sass.git rules_sass
$ cd rules_sass
$ bazel build //...
I know that it works for some people, but I get the following:
[mark@arch rules_sass]$ bazel build //...
........
INFO: Analysed 5 targets (16 packages loaded).
INFO: Found 5 targets...
ERROR: /home/mark/.cache/bazel/_bazel_mark/102e5c7ceb737dbe98e59b2e1d756774/external/sassc/BUILD.bazel:4:1: undeclared inclusion(s) in rule '@sassc//:sassc':
this rule is missing dependency declarations for the following files included by 'external/sassc/sassc.c':
'/usr/include/stdc-predef.h'
'/usr/include/stdio.h'
'/usr/include/bits/libc-header-start.h'
'/usr/include/features.h'
'/usr/include/sys/cdefs.h'
'/usr/include/bits/wordsize.h'
'/usr/include/bits/long-double.h'
'/usr/include/gnu/stubs.h'
'/usr/include/gnu/stubs-64.h'
'/usr/include/stddef.h'
'/usr/include/bits/types.h'
'/usr/include/bits/typesizes.h'
'/usr/include/bits/types/__FILE.h'
'/usr/include/bits/types/FILE.h'
'/usr/include/libio.h'
'/usr/include/_G_config.h'
'/usr/include/bits/types/__mbstate_t.h'
'/usr/include/stdarg.h'
'/usr/include/bits/stdio_lim.h'
'/usr/include/bits/sys_errlist.h'
'/usr/include/bits/stdio.h'
'/usr/include/bits/stdio2.h'
'/usr/include/string.h'
'/usr/include/bits/types/locale_t.h'
'/usr/include/bits/types/__locale_t.h'
'/usr/include/strings.h'
'/usr/include/bits/strings_fortified.h'
'/usr/include/bits/string_fortified.h'
'/usr/include/stdlib.h'
'/usr/include/bits/waitflags.h'
'/usr/include/bits/waitstatus.h'
'/usr/include/bits/floatn.h'
'/usr/include/sys/types.h'
'/usr/include/bits/types/clock_t.h'
'/usr/include/bits/types/clockid_t.h'
'/usr/include/bits/types/time_t.h'
'/usr/include/bits/types/timer_t.h'
'/usr/include/bits/stdint-intn.h'
'/usr/include/endian.h'
'/usr/include/bits/endian.h'
'/usr/include/bits/byteswap.h'
'/usr/include/bits/byteswap-16.h'
'/usr/include/bits/uintn-identity.h'
'/usr/include/sys/select.h'
'/usr/include/bits/select.h'
'/usr/include/bits/types/sigset_t.h'
'/usr/include/bits/types/__sigset_t.h'
'/usr/include/bits/types/struct_timeval.h'
'/usr/include/bits/types/struct_timespec.h'
'/usr/include/bits/select2.h'
'/usr/include/sys/sysmacros.h'
'/usr/include/bits/sysmacros.h'
'/usr/include/bits/pthreadtypes.h'
'/usr/include/bits/thread-shared-types.h'
'/usr/include/bits/pthreadtypes-arch.h'
'/usr/include/alloca.h'
'/usr/include/bits/stdlib-bsearch.h'
'/usr/include/bits/stdlib-float.h'
'/usr/include/bits/stdlib.h'
'/usr/include/getopt.h'
'/usr/include/bits/getopt_core.h'
'/usr/include/bits/getopt_ext.h'
'/usr/include/stdbool.h'
INFO: Elapsed time: 4.255s, Critical Path: 1.39s
FAILED: Build did NOT complete successfully
The same sort of error manifests itself with other projects (the exact message is different, of course).
What operating system are you running Bazel on?
Arch Linux, I know there is an issue with inclusion detection in 0.10 as reported in https://github.com/bazelbuild/bazel/issues/4572, but I’m using Bazel from Nix which is 0.9.
What’s the output of bazel info release
?
[mark@arch rules_sass]$ bazel info release
release 0.9.0- (@non-git)
[mark@arch rules_sass]$ bazel version
Build label: 0.9.0- (@non-git)
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Sat Nov 2 00:00:00 +11968 (315532800000)
Build timestamp: 315532800000
Build timestamp as int: 315532800000
If bazel info release
returns “development version” or “(@non-git)”, tell us how you built Bazel.
As I said it comes from Nix.
Have you found anything relevant by searching the web?
Yes I found a few similar issues, but I the fixes are inapplicable unless I’m expected to patch every dependency (such as rules_sass
) to make it work.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17 (13 by maintainers)
Just had a similar issue on arch linux. Running
bazel clean --expunge
resolved it.There have been many fixes in cc_configure since March, I’d try getting the latest bazel (0.21 is the latest today), run
bazel clean --expunge
so we are sure there is no dirty state in the output base, and everything should work.Please reopen or fine a new issue when it is not true 😃
I know this is a closed issue, but just wanted to leave a comment here, in case it is useful to others:
Faced a similar issue as above while building protobuf with bazel. My bazel was originally installed system-wide. When I reinstalled bazel locally only for the current user and deleted the bazel cache and built again, the build completed successfully.
Bazel version 0.11 (I know it’s a very old version, but sadly that’s what is mandated in my team)