Closed meteorcloudy closed 5 years ago
This is not a bug. We intentionally add "." as an include directory for each cc_library. "malloc" happens to be a dependency that adds external/bazel_tools, but if it weren't this library, it could very well be a different implicit dependency that we add.
Then src/main/cpp/util from java_tools clashes with the one from external/bazel_tools. In any case the one from java_tools could have been renamed.
How headers and include directories work will be under going some modifications. The main bug thread to follow is this one: https://github.com/bazelbuild/bazel/issues/6790
We're seeing failure caused by this issue here again: https://buildkite.com/bazel/bazel-federation/builds/19#ee3795da-1088-4c27-b81e-2636e30e3587
https://buildkite.com/bazel/bazel-federation/builds/19#ee3795da-1088-4c27-b81e-2636e30e3587 The issue turned out to be https://github.com/bazelbuild/bazel/issues/9172, it has nothing to do with this one.
By default, every cc_library and cc_binary depends on
@bazel_tools//tools/cpp:malloc
, this is causing every cc compilation to haveexternal/bazel_tools
as a header search directory. In non-sandboxed build, the compiler will always see headers fromexternal/bazel_tools
first. If you have the same header path (eg.src/main/cpp/util/file.h
) in other directory, it will be ignored and the code will be compiled against the wrong header and fail with a header check error.@oquenchil @hlopko
Related issue #8614 https://github.com/bazelbuild/bazel/pull/8954