fix: pick the glibc SDK on glibc hosts, and stop skipping the suite (#215) - #229
Merged
Merged
Conversation
…215) Two independent problems made `main` unusable for local development on a glibc machine. 1. fetch_zvec_sdk.sh selected the musl SDK The musl check was `ls /lib/ld-musl-*.so.1`. On any glibc host with musl-tools installed that succeeds, so the musl SDK was unpacked and every single test then failed at ZVec::ffi() with libc.musl-x86_64.so.1: cannot open shared object file The property that matters is not what the machine has but which loader the PHP binary uses, so the detection now inspects `ldd $(command -v php)`, falls back to /bin/sh when there is no PHP, and assumes glibc when neither marker is found. `PHP_BINARY` overrides the probe. The SDK layout then hid the problem: `copy_if_different` in ffi/CMakeLists.txt keeps the previously copied libzvec.so when the new SDK's copy has a different mtime, so a stale musl libzvec.so sat next to a freshly linked adapter. Removing sdk/ and ffi/build/ before rebuilding resolves it, which AGENTS.md now spells out. 2. The documented test command skipped 172 of 191 tests AGENTS.md mandated `php run-tests.php -n tests/`. `-n` strips php.ini, and FFI is provided by conf.d/20-ffi.ini here rather than being compiled in, so FFI disappeared and the whole suite reported SKIP with "reason: FFI extension not available" -- on a machine where FFI was available and working. The 16 tests that did run passed, so the failure mode was a green-looking summary over almost nothing. The actual goal is FFI enabled *and* the legacy zvec extension disabled, which is `php run-tests.php -n -d extension=ffi.so tests/`. All test commands in AGENTS.md and the closing hint in build_zvec.sh updated, with a note that a run reporting skips is a broken run rather than a pass. Tests: 191/191, 0 skipped, 0 failed, 2 expected fail, verified from a clean `rm -rf sdk ffi/build && ./build_zvec.sh`.
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the #215 work on
main. Two problems there made local development on a glibc machine impossible. Both were hit while trying to run the milestone-0.7 issues.1.
fetch_zvec_sdk.shpicked the musl SDKOn any glibc host with
musl-toolsinstalled that succeeds. The musl SDK got unpacked, and every test failed atZVec::ffi():The property that matters is not what the machine has installed but which loader the PHP binary uses, so detection now inspects
ldd $(command -v php), falls back to/bin/shwhen there is no PHP, and assumes glibc when neither marker is present.PHP_BINARYoverrides the probe.The SDK layout then hid it.
copy_if_differentinffi/CMakeLists.txtkeeps the previously copiedlibzvec.sowhen the incoming one has a different mtime, so a stale musllibzvec.sosat next to a freshly linked adapter and the adapter built and linked fine.rm -rf sdk ffi/buildis needed when switching SDKs — now documented.2. The documented test command skipped 172 of 191 tests
AGENTS.md mandated
php run-tests.php -n tests/.-nstripsphp.ini, and FFI comes fromconf.d/20-ffi.inihere rather than being compiled in:So the whole suite reported
SKIP ... reason: FFI extension not available, and the 16 tests that did run passed — a green-looking summary over almost nothing:The real goal is FFI enabled and the legacy
zvecextension disabled, which isphp run-tests.php -n -d extension=ffi.so tests/. Updated everywhere, plus a note that a run reporting skips is a broken run rather than a pass.Verification
From a clean tree:
rm -rf sdk ffi/build && ./build_zvec.sh php run-tests.php -n -d extension=ffi.so tests/test_dbs/is left with only.gitignore.Note
The
Mismatched free() / deletefinding from #228 is still open and untouched here.🤖 Generated with Claude Code