mirror of
https://github.com/openai/codex.git
synced 2026-03-05 13:35:28 +03:00
note:
unfortunately, tokio-tungstenite / tungstenite upgrade triggers some
problems with linker of rama-tls-boring with openssl:
```
error: linking with `/Users/apanasenko/Library/Caches/cargo-zigbuild/0.20.1/zigcc-x86_64-unknown-linux-musl-ff6a.sh` failed: exit status: 1
|
= note: "/Users/apanasenko/Library/Caches/cargo-zigbuild/0.20.1/zigcc-x86_64-unknown-linux-musl-ff6a.sh" "-m64" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/{liblzma_sys-662a82316f96ec30,libbzip2_sys-bf78a2d58d5cbce6,liblibsqlite3_sys-6c004987fd67a36a,libtree_sitter_bash-220b99a97d331ab7,libtree_sitter-858f0a1dbfea58bd,libzstd_sys-6eb237deec748c5b,libring-2a87376483bf916f,libopenssl_sys-7c189e68b37fe2bb,liblibz_sys-4344eef4345520b1,librama_boring_sys-0414e98115015ee0}.rlib" "-lc++" "-lc++abi" "-lunwind" "-lc" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-*.rlib" "-L" "/var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/raw-dylibs" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/libz-sys-ff5ea50d88c28ffb/out/lib" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/ring-bdec3dddc19f5a5e/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/openssl-sys-96e0870de3ca22bc/out/openssl-build/install/lib" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/zstd-sys-0cc37a5da1481740/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/tree-sitter-72d2418073317c0f/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/tree-sitter-bash-bfd293a9f333ce6a/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/libsqlite3-sys-b78b2cfb81a330fc/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/bzip2-sys-69a145cc859ef275/out/lib" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/lzma-sys-07e92d0b6baa6fd4/out" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/build/crypto/" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/build/ssl/" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/build/" "-L" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/build" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib" "-o" "/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/deps/codex_network_proxy-d08268b863517761" "-Wl,--gc-sections" "-static-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "<sysroot>/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: warning: ignoring deprecated linker optimization setting '1'
warning: unable to open library directory '/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/build/crypto/': FileNotFound
ld.lld: error: duplicate symbol: SSL_export_keying_material
>>> defined at ssl_lib.c:3816 (ssl/ssl_lib.c:3816)
>>> libssl-lib-ssl_lib.o:(SSL_export_keying_material) in archive /var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/libopenssl_sys-7c189e68b37fe2bb.rlib
>>> defined at t1_enc.cc:205 (/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/boringssl/ssl/t1_enc.cc:205)
>>> t1_enc.cc.o:(.text.SSL_export_keying_material+0x0) in archive /var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/librama_boring_sys-0414e98115015ee0.rlib
ld.lld: error: duplicate symbol: d2i_ASN1_TIME
>>> defined at a_time.c:27 (crypto/asn1/a_time.c:27)
>>> libcrypto-lib-a_time.o:(d2i_ASN1_TIME) in archive /var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/libopenssl_sys-7c189e68b37fe2bb.rlib
>>> defined at a_time.cc:34 (/Users/apanasenko/code/codex/codex-rs/target/x86_64-unknown-linux-musl/release/build/rama-boring-sys-0bc2dfbf669addc4/out/boringssl/crypto/asn1/a_time.cc:34)
>>> a_time.cc.o:(.text.d2i_ASN1_TIME+0x0) in archive /var/folders/kt/52y_g75x3ng8ktvk3rfwm6400000gp/T/rustcyGQdYm/librama_boring_sys-0414e98115015ee0.rlib
```
that force me to migrate away from rama-tls-boring to rama-tls-rustls
and pin `ring` for rustls.
87 lines
2.9 KiB
Diff
87 lines
2.9 KiB
Diff
diff --git a/builder/cc_builder.rs b/builder/cc_builder.rs
|
|
--- a/builder/cc_builder.rs
|
|
+++ b/builder/cc_builder.rs
|
|
@@ -26,7 +26,7 @@
|
|
};
|
|
use std::cell::Cell;
|
|
use std::collections::HashMap;
|
|
-use std::path::PathBuf;
|
|
+use std::path::{Path, PathBuf};
|
|
|
|
#[non_exhaustive]
|
|
#[derive(PartialEq, Eq)]
|
|
@@ -661,6 +661,16 @@
|
|
}
|
|
let mut memcmp_compile_args = Vec::from(memcmp_compiler.args());
|
|
|
|
+ // Keep the probe self-contained and avoid invoking external debug tools
|
|
+ // (for example `dsymutil`) that may be missing in hermetic sandboxes.
|
|
+ memcmp_compile_args.retain(|arg| {
|
|
+ let Some(arg_str) = arg.to_str() else {
|
|
+ return true;
|
|
+ };
|
|
+ !arg_str.starts_with("-g")
|
|
+ });
|
|
+ memcmp_compile_args.push("-g0".into());
|
|
+
|
|
// This check invokes the compiled executable and hence needs to link
|
|
// it. CMake handles this via LDFLAGS but `cc` doesn't. In setups with
|
|
// custom linker setups this could lead to a mismatch between the
|
|
@@ -672,6 +682,15 @@
|
|
}
|
|
}
|
|
|
|
+ if let Some(execroot) = Self::bazel_execroot(self.manifest_dir.as_path()) {
|
|
+ // In Bazel build-script sandboxes, `cc` can pass `bazel-out/...` args
|
|
+ // relative to the execroot while the process runs from elsewhere.
|
|
+ // Normalize those args to absolute paths so this check can still link.
|
|
+ for arg in &mut memcmp_compile_args {
|
|
+ Self::rewrite_bazel_execroot_arg(execroot.as_path(), arg);
|
|
+ }
|
|
+ }
|
|
+
|
|
memcmp_compile_args.push(
|
|
self.manifest_dir
|
|
.join("aws-lc")
|
|
@@ -725,6 +744,40 @@
|
|
}
|
|
let _ = fs::remove_file(exec_path);
|
|
}
|
|
+
|
|
+ fn rewrite_bazel_execroot_arg(execroot: &Path, arg: &mut std::ffi::OsString) {
|
|
+ let Some(arg_str) = arg.to_str() else {
|
|
+ return;
|
|
+ };
|
|
+
|
|
+ if arg_str.starts_with("bazel-out/") {
|
|
+ *arg = execroot.join(arg_str).into_os_string();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ for flag_prefix in ["-B", "-L"] {
|
|
+ if let Some(path) = arg_str.strip_prefix(flag_prefix) {
|
|
+ if path.starts_with("bazel-out/") {
|
|
+ *arg = format!("{flag_prefix}{}", execroot.join(path).display()).into();
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ fn bazel_execroot(path: &Path) -> Option<PathBuf> {
|
|
+ let mut prefix = PathBuf::new();
|
|
+ for component in path.components() {
|
|
+ if component.as_os_str() == "bazel-out" {
|
|
+ return Some(prefix);
|
|
+ }
|
|
+
|
|
+ prefix.push(component.as_os_str());
|
|
+ }
|
|
+
|
|
+ None
|
|
+ }
|
|
+
|
|
fn run_compiler_checks(&self, cc_build: &mut cc::Build) {
|
|
if self.compiler_check("stdalign_check", Vec::<&'static str>::new()) {
|
|
cc_build.define("AWS_LC_STDALIGN_AVAILABLE", Some("1"));
|