Repository navigation
llama.cpp: ship the SONAME links so llama-cli/llama-server start - #1371
Conversation
`install -vm755 build/bin/*.so` followed each lib*.so -> lib*.so.0 -> lib*.so.0.x.y chain and installed the library under its unversioned name only. The binaries and the *-impl.so libraries need the SONAMEs (libllama.so.0, libllama-common.so.0, libmtmd.so.0, libggml*.so.0), which never shipped, so both binaries exited 127 at load. Copy build/bin/*.so* with cp -a, add a build-time check that every DT_NEEDED this build produced is in the output (fail closed, non-vacuous), and add standalone --version smoke tests for both binaries with no test_deps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 32 minutes for your next included review. View limit details
|
norrietaylor
left a comment
There was a problem hiding this comment.
Scope matches the title. The diff changes how build.sh installs the libraries, adds a fail-closed DT_NEEDED check and adds two standalone smoke tests. Nothing else changes. Clobber none. git log on packages/llama.cpp shows that the PR keeps the pinned web-UI work from #879 and the b12110 bump from #1330. Correctness cp -a keeps the symlinks (-a implies -P), and the usr/lib/* OutputLib glob covers all three names. The readelf | sed expression matches the (NEEDED) Shared library: [x] lines. -e build/bin/$lib follows the SONAME symlink. The found counter stops the check from passing vacuously. toolchain supplies readelf. standaloneTest is an existing helper, and redis, netcat, gdbm, less and coreutils use it the same way. The new tests are the regression tests for the fix. The bug is local to this package: the only other install ... *.so in a build.sh is nss, and its libraries have unversioned SONAMEs. One nit is on comments that narrate history. Not checked the build and the tests themselves, because they need a build. The PR body reports both, with negative controls.
| # The shared libraries ship as built: lib*.so -> lib*.so.0 -> lib*.so.0.x.y. | ||
| # `install build/bin/*.so` followed each link and wrote the library under its | ||
| # unversioned name only, so the binaries' DT_NEEDED (the SONAME, libllama.so.0 | ||
| # etc.) was never shipped and llama-cli/llama-server exited 127 at startup. |
There was a problem hiding this comment.
nit · Only the first sentence explains the code. The rest tells how the old install line failed, and that is the PR's story. build.ncl:82-83 does the same thing ("Both binaries exited 127 ... before build.sh kept the SONAME links"). Keep the reason in both places: cp -a keeps the SONAME symlinks, and the tests use no test_deps because base can mask a missing library. Move the history to the commit message.
Problem
llama-cli --versionandllama-server --versionexit 127. The loader can't findlibllama.so.0,libllama-common.so.0,libmtmd.so.0orlibggml*.so.0. This turned up in the 2026-11-06 smoke-test sweep on an arm64 min session.Root cause
This line in
packages/llama.cpp/build.sh:The build makes each library as
lib*.so -> lib*.so.0 -> lib*.so.0.x.y.installfollows the link and writes the real file under the unversioned name only. Everything links against the SONAME (*.so.0), and that name was never shipped.Fix
cp -av build/bin/*.so* $OUTPUT_DIR/usr/lib/keeps the links and the real files. The outputs globusr/lib/*already covers them.build/bin) but that is missing from$OUTPUT_DIR/usr/lib. It also fails if no DT_NEEDED resolves tobuild/binat all, so the check can't pass vacuously./usr/bin/llama-cli --versionand/usr/bin/llama-server --version. They have notest_deps, because base would mask a missing library.The pinned web-UI Source, its unpack step and the license notes (pkgs#994) are untouched.
Verification (arm64 min session,
pkgbuildloadout)min package build --rebuildsucceeds. It installslibllama.so{,.0,.0.9.0},libggml*.so{,.0,.0.29.0},libmtmd,libllama-common, and the*-impl.solibraries. Inmin check --packages llama.cppevery check passes, includingstandalone tests,missing runtime_depsandfmt.build.shfrom main plus the new tests. The build succeeds, butstandalone tests...Fail, withllama-cliandllama-servereach exiting with code 127.installline plus the new check. The build fails withERROR: .../libllama.so needs libggml.so.0, built here but not installedand similar errors forlibmtmd.so,libllama-server-impl.soand the others.Rebuild scope
Only llama.cpp. Nothing in pkgs imports it.
🤖 Generated with Claude Code