-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enable CC toolchain to use in-tree builtin includes #23615
base: master
Are you sure you want to change the base?
Conversation
If the toolchain is composed in our build tree and we use an internal (relative) path for the `builtin_sysroot` that we pass to `create_cc_toolchain_config_info`, and we pass a value like `%sysroot%/usr/include` in `cxx_builtin_include_directories` then we will fail with missing dependency declarations. Instead of only using the absolute paths for builtin includes, we can use all of them and do an additional matching check after we relativized the paths to the individual include items.
66dd968
to
3276a46
Compare
@lberki or @oquenchil any opinions on this? |
Do I understand correctly: The key effect of this change is that all CcToolchain built_in_include_directories entries would be treated the same, regardless of whether they are absolute or relative paths? |
Yes, I believe so. In my case, specifically, I'm using a toolchain that we're constructing as part of our build, so the built-in includes show up in bazel-out |
Sorry for the naïve question, but do you have a concrete example or sample toolchain? It seems quite odd to me to have output directories like bazel-out be present in include directories -- having outputs like this appear as inputs but with paths constructed outside of bazel seems potentially problematic, but perhaps I'm missing something simple. (Is this a two stage build? How are you deriving these paths?) I am trying to dig into the code in question to better understand why this requirement exists in the first place... |
I'm also wondering if something other than More info on the include dir prefixes here: https://cs.opensource.google/bazel/bazel/+/master:src/main/starlark/builtins_bzl/common/cc/cc_toolchain_provider_helper.bzl;l=103-122;drc=f2318d2cbf38d249d620dc99a11570843306a6fa |
tl;dr we're driving an internal hermetic toolchain that's derived from the contents of RPMs. It'll be hard to distill down into some thing trivial, but let me attempt to at least describe the details. Longer version:
which ultimately synthesizes a repository to capture the sysroot
The The
|
The issue appears to be that it doesn't like relative paths which %workspace% is also going to give us. |
Backing up a bit to the most likely culprit just to double check: have you passed |
Separately, I need to stare at this change longer to determine whether or not it's correct but at first glance I think it is. |
If the toolchain is composed in our build tree and we use an internal (relative) path for the
builtin_sysroot
that we pass tocreate_cc_toolchain_config_info
, and we pass a value like%sysroot%/usr/include
incxx_builtin_include_directories
then we will fail with missing dependency declarations.Instead of only using the absolute paths for builtin includes, we can use all of them and do an additional matching check after we relativized the paths to the individual include items.