Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(local): curl flags, openssl flags (#4600)

teof0e500825d39
diff --git a/nix/cloud-storage.nix b/nix/cloud-storage.nix
index eb9aeaf1e1..0f908c52e1 100644
--- a/nix/cloud-storage.nix
+++ b/nix/cloud-storage.nix
@@ -678,6 +678,9 @@
zig
cmake
nasm
+ # openssl-src (vendored OpenSSL for zigbuild cross builds, see the
+ # OPENSSL_NO_VENDOR notes above) runs OpenSSL's perl-based Configure.
+ perl
(writeShellScriptBin "rustup" ''
set -euo pipefail
rustc_path="$(${coreutils}/bin/readlink -f "$(command -v rustc)")"
@@ -819,6 +822,17 @@
# the Nix lambda derivations. The default cc builder rejects
# cargo-lambda/cargo-zigbuild's Zig cc wrapper.
AWS_LC_SYS_CMAKE_BUILDER = "1";
+ # cargo-zigbuild compiles C with zig cc, which ignores the Nix
+ # cc-wrapper's NIX_CFLAGS_COMPILE — so the curl.dev headers that
+ # buildInputs provides to host builds (see the note on `libraries`;
+ # librdkafka 2.12 needs curl headers even with WITH_CURL=0) are
+ # invisible to zigbuild cross builds. cc-rs and cmake-rs honor
+ # these target-scoped forms, so only the Linux cross targets get
+ # the include path; host builds keep their Nix cc-wrapper flags.
+ CFLAGS_aarch64_unknown_linux_gnu = "-I${pkgs.curl.dev}/include";
+ CXXFLAGS_aarch64_unknown_linux_gnu = "-I${pkgs.curl.dev}/include";
+ CFLAGS_x86_64_unknown_linux_gnu = "-I${pkgs.curl.dev}/include";
+ CXXFLAGS_x86_64_unknown_linux_gnu = "-I${pkgs.curl.dev}/include";
}
// pkgs.lib.optionalAttrs isLinux {
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libraries}";
diff --git a/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rs b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rs
index 988919f9ca..cce67464c1 100644
--- a/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rs
+++ b/rust/cloud-storage/tools/xtask/crates/xtask_local/src/local/build/zigbuild.rs
@@ -88,6 +88,12 @@ fn base_command(ws: &Path, zig_cache: &Path, jobs: &str, target: Target) -> Comm
.env("SQLX_OFFLINE", "true")
.env("CARGO_PROFILE_DEV_DEBUG", "0")
.env("AWS_LC_SYS_CMAKE_BUILDER", "1")
+ // The nix dev shell pins OPENSSL_NO_VENDOR=1 so host builds link the
+ // Nix openssl, but that openssl can't serve the cross target (pkg-config
+ // refuses cross lookups and the Nix .so's don't exist in the runtime
+ // image). Force rdkafka's ssl-vendored feature back on for zigbuild;
+ // outside the shell the variable is unset and this is a no-op.
+ .env("OPENSSL_NO_VENDOR", "0")
.env("ZIG_GLOBAL_CACHE_DIR", zig_cache)
.env("ZIG_LOCAL_CACHE_DIR", zig_cache)
.env("RUSTC_WRAPPER", "sccache")