mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
## Why Bazel release builds need Cargo-compatible Rust and native build-script settings. Platform-specific issues also include Windows command-line limits, MSVC runtime conflicts with V8's allocator, and a missing V8 `__clear_cache` symbol on ARM64 musl. ## What changed - Add `--config=release` settings for thin LTO, four target codegen units, and disabled debug assertions and overflow checks, with separate settings for build tools. - Add opt-in Cargo release profile support for build-script optimization and debug information, preserving explicit C/C++ flags. Give optimized Bubblewrap builds `-O3`, debug symbols, and enabled native assertions. - Statically link the MSVC CRT for Rust and C/C++ target and host dependencies, and disable SQLite intrinsics on x64 MSVC to avoid startup crashes on older CPUs. - Let the Rust process wrapper read its arguments from a multiline parameter file to avoid Windows command-line limits. - Select the ARM64 musl V8 archive containing compiler-rt builtins and raise the Rust recursion limit to `256` in the app-server client, exec, and TUI entry points for release compilation. GitOrigin-RevId: 8f61e62b8735c36209ee92e04a0e0339a70badc5
39 lines
1.6 KiB
Diff
39 lines
1.6 KiB
Diff
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
|
|
--- a/rust/private/rustc.bzl
|
|
+++ b/rust/private/rustc.bzl
|
|
@@ -1121,6 +1121,9 @@
|
|
|
|
# Wrapper args first
|
|
process_wrapper_flags = ctx.actions.args()
|
|
+ # Build-script file paths can exceed Windows' command-line limit by themselves.
|
|
+ process_wrapper_flags.set_param_file_format("multiline")
|
|
+ process_wrapper_flags.use_param_file("@%s")
|
|
|
|
for build_env_file in build_env_files:
|
|
process_wrapper_flags.add("--env-file", build_env_file)
|
|
diff --git a/util/process_wrapper/options.rs b/util/process_wrapper/options.rs
|
|
--- a/util/process_wrapper/options.rs
|
|
+++ b/util/process_wrapper/options.rs
|
|
@@ -136,10 +136,17 @@
|
|
&mut require_explicit_unstable_features,
|
|
);
|
|
|
|
- let mut child_args = match flags
|
|
- .parse(env::args().collect())
|
|
- .map_err(OptionError::FlagError)?
|
|
- {
|
|
+ let mut args: Vec<String> = env::args().collect();
|
|
+ // Bazel may spill the leading wrapper arguments to a multiline params file.
|
|
+ // Read them verbatim; child rustc @files after `--` are handled separately.
|
|
+ if let Some(path) = args.get(1).and_then(|arg| arg.strip_prefix('@')) {
|
|
+ let contents = std::fs::read_to_string(path).map_err(|err| {
|
|
+ OptionError::Generic(format!("reading wrapper arguments from {path:?}: {err}"))
|
|
+ })?;
|
|
+ args.splice(1..2, contents.lines().map(str::to_owned));
|
|
+ }
|
|
+
|
|
+ let mut child_args = match flags.parse(args).map_err(OptionError::FlagError)? {
|
|
ParseOutcome::Help(help) => {
|
|
eprintln!("{help}");
|
|
exit(0);
|