You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a Ubuntu 17.04 machine, with clang-4.0 installed, I get this error from Bazel for some straightforward C++ code:
this rule is missing dependency declarations for the following files included by 'C-Source/something/other.c':
'/usr/lib/llvm-4.0/lib/clang/4.0.0/include/stdbool.h'
'/usr/lib/llvm-4.0/lib/clang/4.0.0/include/stdint.h'
'/usr/lib/llvm-4.0/lib/clang/4.0.0/include/stddef.h'
I think this is due to a Debian/Ubuntu patch that results in the clang installation system include directory being realpathed in the output of -v but not -MD.
Can I provide help in any way? This is currently a fairly big issue for us grpc folks. The link to the Debian patch provided by @benjaminp seems to be a 404 for me. If you an point me at the exact source of the problem in terms of actual patches links, I can start bugging Debian maintainers about it.
Discovered this issue because I'm unable to build grpc with clang & bazel. I can repro g-easy's build errors on gLinux. This is blocking development of tensorflow/minigo.
Here's how I repro'd g-easy's example:
$ which clang
/usr/bin/clang
$ clang --version
clang version 4.0.1-10 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ which bazel
/usr/local/bin/bazel
$ bazel version
Build label: 0.13.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Oct 18 21:33:40 +50297 (1525078013620)
Build timestamp: 1525078013620
Build timestamp as int: 1525078013620
$ cat cc/bazel.c
#include <stdlib.h>
int main() { return 0; }
$ cat cc/BUILD
cc_binary(
name = "bazel",
srcs = ["bazel.c"],
)
# builds when not setting CC
$ bazel build cc:bazel
[succeeds]
# builds with CC=gcc
$ CC=gcc bazel build cc:bazel
[succeeds]
# does not build with CC=clang
$ CC=clang bazel build cc:bazel
INFO: Analysed target //cc:bazel (1 packages loaded).
INFO: Found 1 target...
ERROR: cc/BUILD:304:1: undeclared inclusion(s) in rule '//cc:bazel':
this rule is missing dependency declarations for the following files included by 'cc/bazel.c':
'/usr/lib/clang/4.0.1/include/stddef.h'
Target //cc:bazel failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.434s, Critical Path: 0.13s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
For completeness, here are the errors I get trying to build grpc's examples:greeter_client:
$ bazel run examples:greeter_client
WARNING: /usr/local/google/home/tmadams/grpc/BUILD:1973:1: in srcs attribute of cc_library rule //:grpc_nanopb: please do not import '//third_party/nanopb:pb_common.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /usr/local/google/home/tmadams/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /usr/local/google/home/tmadams/grpc/BUILD:1973:1: in srcs attribute of cc_library rule //:grpc_nanopb: please do not import '//third_party/nanopb:pb_decode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /usr/local/google/home/tmadams/grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /usr/local/google/home/tmadams/grpc/BUILD:1973:1: in srcs attribute of cc_library rule //:grpc_nanopb: please do not import '//third_party/nanopb:pb_encode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /usr/local/google/home/tmadams/grpc/bazel/grpc_build_system.bzl:172:12
INFO: Analysed target //examples:greeter_client (16 packages loaded).
INFO: Found 1 target...
ERROR: /usr/local/google/home/tmadams/.cache/bazel/_bazel_tmadams/4c83ceb29628e8749e4b91b77f6b4cd3/external/com_github_madler_zlib/BUILD.bazel:1:1: undeclared inclusion(s) in rule '@com_github_madler_zlib//:z':
this rule is missing dependency declarations for the following files included by 'external/com_github_madler_zlib/adler32.c':
'/usr/lib/clang/4.0.1/include/stddef.h'
'/usr/lib/clang/4.0.1/include/__stddef_max_align_t.h'
'/usr/lib/clang/4.0.1/include/limits.h'
'/usr/lib/clang/4.0.1/include/stdarg.h'
Target //examples:greeter_client failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 12.545s, Critical Path: 0.30s
INFO: 3 processes: 2 linux-sandbox, 1 local.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
The fix unfortunately didn't make it into 0.13.0, but will be in 0.14.0 (you can see this in the GitHub UI when you click on the commit id c122e47 - it shows that it's in master, but it doesn't have any release tags). I tried @g-easy 's example with Bazel from HEAD, where it works for me.
Activity
ulfjack commentedon Oct 27, 2017
Failing command line:
It works with clang-3.9:
ulfjack commentedon Oct 27, 2017
The -c and --copt parameters are not relevant. Same behavior without them.
benjaminp commentedon Oct 27, 2017
I think this is due to a Debian/Ubuntu patch that results in the clang installation system include directory being realpathed in the output of
-vbut not-MD.davido commentedon Oct 27, 2017
FYI: Bazel cannot be built on GCC 7 too: #3903.
nicolasnoble commentedon Feb 15, 2018
Is there any bug entered in the Debian bug system about that if we believe this is on them?
ulfjack commentedon Feb 15, 2018
Good point. I don't think we have.
nicolasnoble commentedon Feb 16, 2018
Can I provide help in any way? This is currently a fairly big issue for us grpc folks. The link to the Debian patch provided by @benjaminp seems to be a 404 for me. If you an point me at the exact source of the problem in terms of actual patches links, I can start bugging Debian maintainers about it.
ulfjack commentedon Feb 16, 2018
It might be due to the bugfix for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855222
ulfjack commentedon Feb 16, 2018
Note that I haven't double-checked @benjaminp's statement, but he's usually right about these things.
33 remaining items
ulfjack commentedon May 17, 2018
Unable to reproduce. What does your main.c file look like?
tommadams commentedon May 17, 2018
Discovered this issue because I'm unable to build grpc with clang & bazel. I can repro g-easy's build errors on gLinux. This is blocking development of tensorflow/minigo.
Here's how I repro'd g-easy's example:
For completeness, here are the errors I get trying to build grpc's examples:greeter_client:
g-easy commentedon May 17, 2018
A single line:
ulfjack commentedon May 18, 2018
The fix unfortunately didn't make it into 0.13.0, but will be in 0.14.0 (you can see this in the GitHub UI when you click on the commit id c122e47 - it shows that it's in master, but it doesn't have any release tags). I tried @g-easy 's example with Bazel from HEAD, where it works for me.
tommadams commentedon May 18, 2018
Ah, ok. Thanks!
soonho-tri commentedon May 23, 2018
@ulfjack , is there a chance that c122e47 is included in the upcoming
0.13.1?ulfjack commentedon May 23, 2018
I believe we only cherrypick commits for regressions, not for bug fixes.
ulfjack commentedon May 23, 2018
(That's a no.)
nicolasnoble commentedon May 23, 2018
When is 0.14.0 scheduled then ?
g-easy commentedon May 24, 2018
I can confirm my problem goes away with https://releases.bazel.build/0.14.0/rc2/index.html
Thanks!
lberki commentedon May 24, 2018
0.14 is slated for early next week, according to @lfpino , the current release manager.
nicolasnoble commentedon Jun 26, 2018
I believe that since 0.14 has been released, this issue can be closed now, right ?