Repository navigation
fix(cross): match bindgen libclang to the cross clang on Linux - #250
Conversation
The Linux cross targets in `mkStdTargets` (aarch64, x86_64, i686, riscv64) set `LIBCLANG_PATH` to the default LLVM 18 libclang, while clang-sys takes its builtin header search paths from the cross clang of `pkgsCross.<target>.buildPackages.llvmPackages`, which is LLVM 21 on current nixpkgs. libclang 18 then rejects the clang 21 `stdint.h` (`function-like macro '__INT32_C' is not defined`), so any bindgen build script fails for these targets. The existing `BINDGEN_EXTRA_CLANG_ARGS_<target>` pointed at a hardcoded `lib/clang/18/include/` path, which no longer exists. Set `LIBCLANG_PATH` from the same cross LLVM, and pass the target glibc headers to bindgen instead: the unwrapped cross clang reports no libc include path, so headers like `stdlib.h` were not found either. `fullChecks` `aarch64-linux.ci.workspaceBuild` (librocksdb-sys bindgen) failed with the error above and builds with this change. Rho-Agent-Id: kjhiaepqvmpb
|
Posted by Tau Code review passed for 87b61c9. The Linux-only cross-target fix consistently matches libclang to the cross LLVM and adds the target libc headers; no blocking code findings. Linux Build and Lint passed. The author reports successful aarch64 RocksDB and downstream aws-lc-sys builds; I did not independently rerun those builds. I am leaving this unmerged because the required macOS Build failed in run 43021945638: the Android platform-tools_r37.0.0-darwin.zip download has a fixed-output hash mismatch. Flake self-check also confirms that the unchanged nixpkgs input is 127 days old, exceeding its 30-day limit. These failures are outside this Linux-only patch, but required checks still block normal merge. No protection bypass or unrelated lock update attempted. |
### Motivation The macOS build in rustshop#250 repeatedly failed because the pinned Android SDK metadata expected a different SHA-1 for `platform-tools_r37.0.0-darwin.zip` than Google serves. This failure predates rustshop#250. The flake self-check also rejects the old Nixpkgs input. ### Changes Update the Android input to the November 10 stable snapshot, which selects platform-tools 37.0.1 and retains the upstream emulator build fix that motivated the old pin. Google's stable-channel repository metadata publishes the same Darwin and Linux checksums, and both archives were independently verified against them. Do not override the historical 37.0.0 hash: the reason its downloaded bytes changed has not been established. Avoid the November 11 Android snapshot because it selects canary platform-tools 37.0.3. Refresh Nixpkgs within the existing `nixos-26.05` branch to its November 8 revision. The Android input's devshell dependency updates with it; other inputs remain pinned. Rebase onto the advanced upstream master, preserving its recently merged hook, linker, and lint changes. Resolve the Nixpkgs lock conflict by retaining the newer November 8 revision rather than upstream's September 5 revision. Also apply the formatter's comment-only wrap in the hook timer: the new base already fails treefmt on that comment, and the wrap fixes that lint failure without changing behavior. ### Validation The rebased change passes `nix develop -c selfci check -c vvsmpkms`, including treefmt, ast-grep, and the full local Linux flake check. The official flake checker also passes with CI's options. Both platform-tools source archives match Google's published stable-channel hashes. The original PR head passed Linux and macOS CI. The rebased head has not yet been tested in CI and includes additional upstream changes. ### Review Independent code review passed before and after rebasing, with no findings or required spec changes. The rebase review confirmed preservation of upstream changes and dependency pins, and that the timer-file change only wraps a comment.
### Motivation The macOS build in rustshop#250 repeatedly failed because the pinned Android SDK metadata expected a different SHA-1 for `platform-tools_r37.0.0-darwin.zip` than Google currently serves. This failure predates rustshop#250. The flake self-check also rejects the old Nixpkgs input. ### Changes Update Android metadata to the November 10 stable snapshot, retaining the upstream emulator build fix and selecting stable platform-tools 37.0.1. Its Darwin and Linux checksums match Google's stable-channel metadata and independently fetched archives. Do not override the historical 37.0.0 hash: the reason its bytes changed remains unknown. Avoid the November 11 snapshot because it selects canary 37.0.3. Refresh Nixpkgs within `nixos-26.05` to the November 8 revision. Preserve that newer pin when rebasing over upstream's September 5 pin. The Android input's devshell dependency updates with it; other inputs remain pinned. Updated upstream adds hook and prose checks that expose additional inherited lint failures. Replace an unused `root` assignment in the shell-hook generator with the same Git-root check, discarding its output. Regenerate the shell hook, root identity, and Just file; the latter's Bash path follows the updated Nixpkgs input. Extend Vale's project vocabulary for existing systems terms and sentence-case “Dev”. Also wrap an existing timer comment as treefmt requires. These fixes preserve hook behavior and keep all lint checks enabled; the implicated source and prose matched upstream before the fixes. ### Validation The exact GitHub Commit Check command now passes: `nix develop --ignore-environment .#lint --command ./misc/git-hooks/pre-commit`. It previously reproduced the unused-variable and fifteen Vale errors. `nix develop -c selfci check -c vvsmpkms` also passes, including the Linux flake checks and hook integration coverage. Regenerating again leaves the candidate unchanged. The official flake checker passes locally. The original PR head passed Linux and macOS CI; the updated head is awaiting CI. ### Review Independent review passed for the dependency repair, rebase, and inherited lint repairs, with no findings or required spec changes. Review confirmed preservation of upstream changes and pins, equivalent shell-guard behavior, synchronized generated files, and narrowly scoped vocabulary additions.
### Motivation The macOS build in #250 repeatedly failed because the pinned Android SDK metadata expected a different SHA-1 for `platform-tools_r37.0.0-darwin.zip` than Google currently serves. This failure predates #250. The flake self-check also rejects the old Nixpkgs input. ### Changes Update Android metadata to the November 10 stable snapshot, retaining the upstream emulator build fix and selecting stable platform-tools 37.0.1. Its Darwin and Linux checksums match Google's stable-channel metadata and independently fetched archives. Do not override the historical 37.0.0 hash: the reason its bytes changed remains unknown. Avoid the November 11 snapshot because it selects canary 37.0.3. Refresh Nixpkgs within `nixos-26.05` to the November 8 revision. Preserve that newer pin when rebasing over upstream's September 5 pin. The Android input's devshell dependency updates with it; other inputs remain pinned. Updated upstream adds hook and prose checks that expose additional inherited lint failures. Replace an unused `root` assignment in the shell-hook generator with the same Git-root check, discarding its output. Regenerate the shell hook, root identity, and Just file; the latter's Bash path follows the updated Nixpkgs input. Extend Vale's project vocabulary for existing systems terms and sentence-case “Dev”. Also wrap an existing timer comment as treefmt requires. These fixes preserve hook behavior and keep all lint checks enabled; the implicated source and prose matched upstream before the fixes. ### Validation The exact GitHub Commit Check command now passes: `nix develop --ignore-environment .#lint --command ./misc/git-hooks/pre-commit`. It previously reproduced the unused-variable and fifteen Vale errors. `nix develop -c selfci check -c vvsmpkms` also passes, including the Linux flake checks and hook integration coverage. Regenerating again leaves the candidate unchanged. The official flake checker passes locally. The original PR head passed Linux and macOS CI; the updated head is awaiting CI. ### Review Independent review passed for the dependency repair, rebase, and inherited lint repairs, with no findings or required spec changes. Review confirmed preservation of upstream changes and pins, equivalent shell-guard behavior, synchronized generated files, and narrowly scoped vocabulary additions.
The Linux cross targets in
mkStdTargets(aarch64-linux,x86_64-linux,i686-linux,riscv64-linux) run bindgen with mismatched LLVM versions:LIBCLANG_PATHcomes frommkTarget's default,llvmPackages_18.libclang.LLVM_CONFIG_PATH_<target>reports. That clang ispkgsCross.<target>.buildPackages.llvmPackages, which is LLVM 21 on current nixpkgs.BINDGEN_EXTRA_CLANG_ARGS_<target>pointed at a hardcodedlib/clang/18/include/, which does not exist in the LLVM 21 package.libclang 18 then rejects the clang 21
stdint.h:Separately, the unwrapped cross clang reports no libc include path, so bindgen also fails on
stdlib.h(seen with aws-lc-sys).This sets
LIBCLANG_PATHfrom the same cross LLVM and passes the target glibc headers to bindgen with-isystem. TheCFLAGS/CPPFLAGS/CXXFLAGSclang/18flags are left as they are. They only affect C compiles through the wrapped clang, and on current nixpkgs they point at a path that does not exist.Verification on x86_64-linux:
fullChecksaarch64-linux.ci.workspaceBuild(librocksdb-sys bindgen) fails on master with the error above. It builds with this change.x86_64-linuxis the native target on an x86_64 host, so this change does not affect it there. I did not buildi686-linuxorriscv64-linux, because the build host ran out of disk.bindgen) cross-builds foraarch64-unknown-linux-gnuwith this change and no local workaround.The patch is based on the GitHub
master. It applies unchanged on the current Radicle head (105902c), becauselib/mkStdTargets.nixis the same in both.