mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +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
63 lines
1.8 KiB
Rust
63 lines
1.8 KiB
Rust
// Release builds exceed rustc's default query depth when laying out the async
|
|
// MessageProcessor::handle_initialized_client_request future.
|
|
#![recursion_limit = "256"]
|
|
|
|
use clap::Parser;
|
|
use codex_arg0::Arg0DispatchPaths;
|
|
use codex_arg0::arg0_dispatch_or_else;
|
|
use codex_config::LoaderOverrides;
|
|
use codex_tui::Cli;
|
|
use codex_tui::ExitReason;
|
|
use codex_tui::run_main;
|
|
use codex_utils_cli::CliConfigOverrides;
|
|
use std::io::Write;
|
|
use supports_color::Stream;
|
|
|
|
#[derive(Parser, Debug)]
|
|
struct TopCli {
|
|
#[clap(flatten)]
|
|
config_overrides: CliConfigOverrides,
|
|
|
|
#[clap(flatten)]
|
|
inner: Cli,
|
|
}
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
codex_build_info::initialize!();
|
|
arg0_dispatch_or_else(|arg0_paths: Arg0DispatchPaths| async move {
|
|
let top_cli = TopCli::parse();
|
|
let mut inner = top_cli.inner;
|
|
inner
|
|
.config_overrides
|
|
.raw_overrides
|
|
.splice(0..0, top_cli.config_overrides.raw_overrides);
|
|
let exit_info = run_main(
|
|
inner,
|
|
arg0_paths,
|
|
LoaderOverrides::default(),
|
|
/*explicit_remote_endpoint*/ None,
|
|
)
|
|
.await?;
|
|
let is_fatal = match &exit_info.exit_reason {
|
|
ExitReason::Fatal(message) => {
|
|
eprintln!("ERROR: {message}");
|
|
true
|
|
}
|
|
ExitReason::UserRequested
|
|
| ExitReason::Archived(_)
|
|
| ExitReason::TurnInterrupted
|
|
| ExitReason::ThreadRemoved => false,
|
|
};
|
|
|
|
let color_enabled = supports_color::on(Stream::Stdout).is_some();
|
|
for line in exit_info.format_exit_messages(color_enabled) {
|
|
println!("{line}");
|
|
}
|
|
if is_fatal {
|
|
std::io::stdout().flush()?;
|
|
std::process::exit(1);
|
|
}
|
|
Ok(())
|
|
})
|
|
}
|