Skip to content

Pin OPENSSL_ROOT_DIR in CI so the llama.cpp cold build finds OpenSSL - #1602

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:ns/ci-openssl-root-dir
Jul 10, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:ns/ci-openssl-root-dir

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Kills the recurring test:all flake where the Rust build fails with:

llama.cpp/vendor/cpp-httplib/httplib.h:389:10: fatal error: 'openssl/err.h' file not found

Root cause

llama-cpp-sys-2 builds vendored llama.cpp, whose CMakeLists.txt sets option(LLAMA_OPENSSL "..." ON) by default. With that on, the vendored cpp-httplib compiles with CPPHTTPLIB_OPENSSL_SUPPORT and #include <openssl/err.h>. On the macos-latest runners, Homebrew's openssl@3 is present but not on CMake's default search path, so find_package(OpenSSL) intermittently fails to locate it and the compile errors on the missing header.

It presents as intermittent because swatinem/rust-cache skips the compile entirely on a warm cache — the failure only surfaces on a cold cache (eviction, or a fork PR, which can't read the base repo's cache), which is exactly when a re-run "fixes" it. The crate's build.rs only forwards CMAKE_*-prefixed env vars as CMake defines, so LLAMA_OPENSSL=OFF can't be passed to disable it — the correct fix is to make OpenSSL discoverable.

Fix

In both the test:all and test:e2e jobs, install openssl@3 and pin OPENSSL_ROOT_DIR to its Homebrew prefix so find_package(OpenSSL) succeeds deterministically:

brew install protobuf openssl@3
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"

No product code changes; runtime behavior is unaffected (the daemon does not use cpp-httplib — this only makes the vendored build compile reliably).

Validation

This PR is raised from a fork, so its own CI runs on a cold cache and rebuilds llama-cpp-sys-2 — a green test:all here directly exercises and confirms the fix (the very build that previously flaked).

llama.cpp's vendored cpp-httplib compiles with LLAMA_OPENSSL=ON and includes
<openssl/err.h>. Homebrew's openssl@3 is not on CMake's default search path on
the macOS runners, so find_package(OpenSSL) intermittently misses on a cold
rust-cache and the llama-cpp-sys-2 build fails to compile cpp-httplib. Install
openssl@3 and export OPENSSL_ROOT_DIR in both the test:all and test:e2e jobs so
OpenSSL is located deterministically on every runner.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125
mstomar125 merged commit 69ff11a into NodeSpaceAI:main Jul 10, 2026
2 checks passed
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE — correct root cause, canonical fix, and it's self-validated by its own cold-cache run. This is the right permanent kill for the flake that's been costing re-runs on #1600/#1601.

Root cause is precisely diagnosed

llama-cpp-sys-2 vendors llama.cpp, whose CMakeLists.txt defaults LLAMA_OPENSSL ON, so the vendored cpp-httplib compiles with CPPHTTPLIB_OPENSSL_SUPPORT and #include <openssl/err.h>. Homebrew's openssl@3 is installed on the runners but not on CMake's default search path, so find_package(OpenSSL) misses and the compile dies on the missing header. The "intermittent" behavior is explained correctly: swatinem/rust-cache skips the compile on a warm cache, so it only surfaces on a cold one — cache eviction or a fork PR (which can't read the base repo's cache). That matches exactly what I observed: the flake hit fork PRs (#1600, #1601) and "cleared" on re-run once artifacts warmed. And the note that build.rs only forwards CMAKE_* env → can't pass LLAMA_OPENSSL=OFF, so making OpenSSL discoverable is the correct lever, is accurate.

The mechanism is canonical and correctly scoped

  • OPENSSL_ROOT_DIR is precisely the hint CMake's find_package(OpenSSL) consults — pinning it to $(brew --prefix openssl@3) makes discovery deterministic, and computing it dynamically means it's right on both /opt/homebrew (ARM) and /usr/local (Intel) runners.
  • Written via >> "$GITHUB_ENV" (not export in the run block), so it persists to the subsequent cargo build/test steps rather than dying with the step — correct.
  • No collateral: OPENSSL_ROOT_DIR is a CMake variable; Rust's openssl-sys reads OPENSSL_DIR (a different var), so this doesn't perturb other OpenSSL linkage — it's narrowly confined to the vendored llama.cpp CMake build.

Applied to both jobs, self-validating

The identical block lands in both test:all and test:e2e (both compile the native llama-cpp code, both need it). And because this PR is raised from a fork, its own CI runs on a cold cache and rebuilds llama-cpp-sys-2 — the very build that flaked. Both checks are COMPLETED/SUCCESS, which is direct proof the fix works on the failing path, not just an assertion.

Scope

.github/workflows/ci.yml only, +16/−4; no product code, runtime unaffected (the daemon doesn't use cpp-httplib). Community build behavior unchanged.

Net: correct diagnosis + minimal, deterministic, self-proven fix. This ends the re-run-until-green waste. Approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant