Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external/bazel_tools is a header search directory for all cc compile actions #8955

Closed
meteorcloudy opened this issue Jul 23, 2019 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: bug

Comments

@meteorcloudy
Copy link
Member

By default, every cc_library and cc_binary depends on @bazel_tools//tools/cpp:malloc, this is causing every cc compilation to have external/bazel_tools as a header search directory. In non-sandboxed build, the compiler will always see headers from external/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 #8954

@meteorcloudy meteorcloudy added type: bug P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules labels Jul 23, 2019
@oquenchil oquenchil self-assigned this Aug 6, 2019
@oquenchil
Copy link
Contributor

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:
#6790

@meteorcloudy
Copy link
Member Author

We're seeing failure caused by this issue here again:
https://buildkite.com/bazel/bazel-federation/builds/19#ee3795da-1088-4c27-b81e-2636e30e3587

@meteorcloudy
Copy link
Member Author

https://buildkite.com/bazel/bazel-federation/builds/19#ee3795da-1088-4c27-b81e-2636e30e3587
The issue turned out to be #9172, it has nothing to do with this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

2 participants