mirror of
https://github.com/openai/codex.git
synced 2026-05-01 03:42:05 +03:00
[bazel] Bump up cc and rust toolchains (#14542)
This lets us drop various patches and go all the way to a very clean setup. In case folks are curious what was going on... we were depending on the toolchain finding stdlib headers as sibling files of `clang++`, and for linking we were providing a `-resource-dir` containing the runtime libs. However, some users of the cc toolchain (such as rust build scripts) do the equivalent of `$CC $CCFLAGS $LDFLAGS` so the `-resource-dir` was being passed when compiling, which suppressed the default stdlib header location logic. The upstream fix was to swap to using `-isystem` to pass the stdlib headers, while carefully controlling the ordering to simulate them coming from the resource-dir.
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
diff --git a/toolchain/args/BUILD.bazel b/toolchain/args/BUILD.bazel
|
||||
index 7da0ddb..78326d9 100644
|
||||
--- a/toolchain/args/BUILD.bazel
|
||||
+++ b/toolchain/args/BUILD.bazel
|
||||
@@ -17,8 +17,8 @@ package(default_visibility = ["//visibility:public"])
|
||||
cc_args(
|
||||
name = "resource_dir",
|
||||
actions = [
|
||||
+ "@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
"@rules_cc//cc/toolchains/actions:link_actions",
|
||||
- # We may need it for other actions too?
|
||||
],
|
||||
args = [
|
||||
"-resource-dir",
|
||||
@@ -32,6 +32,25 @@ cc_args(
|
||||
},
|
||||
)
|
||||
|
||||
+cc_args(
|
||||
+ name = "clang_builtin_headers_include_search_paths",
|
||||
+ actions = [
|
||||
+ "@rules_cc//cc/toolchains/actions:compile_actions",
|
||||
+ "@rules_cc//cc/toolchains/actions:link_actions",
|
||||
+ ],
|
||||
+ args = [
|
||||
+ "-isystem",
|
||||
+ "{clang_builtin_headers_include_search_path}",
|
||||
+ ],
|
||||
+ format = {
|
||||
+ "clang_builtin_headers_include_search_path": "//:builtin_headers",
|
||||
+ },
|
||||
+ data = [
|
||||
+ "//:builtin_headers",
|
||||
+ ],
|
||||
+ allowlist_include_directories = ["//:builtin_headers"],
|
||||
+)
|
||||
+
|
||||
cc_args(
|
||||
name = "llvm_target_for_platform",
|
||||
actions = [
|
||||
diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel
|
||||
index 1f89467..8f20f10 100644
|
||||
--- a/toolchain/BUILD.bazel
|
||||
+++ b/toolchain/BUILD.bazel
|
||||
@@ -107,6 +107,7 @@ cc_args_list(
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"//toolchain/args:resource_dir",
|
||||
+ "//toolchain/args:clang_builtin_headers_include_search_paths",
|
||||
],
|
||||
}),
|
||||
)
|
||||
Reference in New Issue
Block a user