fix(#498): package all shared libs in sm60 OCI image (ldd verify, LD_LIBRARY_PATH) - #107
Draft
ddvnguyen wants to merge 4 commits into
Draft
fix(#498): package all shared libs in sm60 OCI image (ldd verify, LD_LIBRARY_PATH)#107ddvnguyen wants to merge 4 commits into
ddvnguyen wants to merge 4 commits into
Conversation
…, ldd verify, LD_LIBRARY_PATH) P100 sm60 image previously shipped only the binary (FROM scratch or COPY without *.so) causing 'undefined symbol: llama_model_get_quant_label' and libllama-server-impl.so missing, with a 1120-restart loop (see ddvnguyen/hydra_vortex#498, hydra_build logs). Root cause: Dockerfile copied only the executable; RUNPATH left build-host paths (/opt/software/.../lib:/mnt/WorkDisk/.../build_sm60/bin) that don't exist on the VM and lib/ was empty while libs were in bin/. Fix: - Dockerfile: COPY bin/ -> /llama now includes *.so* via staging; add RUN ldd verify (fail on 'not found'), ls .so, and ENV LD_LIBRARY_PATH=/llama as fallback. Symlink BINARY -> llama-engine so ENTRYPOINT works for both binaries. - build-combo.sh: cp -a (preserve symlinks), ls staging, host ldd check, warn if libllama-server-impl.so missing for llama-server builds. Build verified with CUDA 12.9 (DCUDAToolkit_ROOT=/opt/software/cuda/12.9) sm60: ldd in container shows zero 'not found', container smoke-start OK. Refs ddvnguyen/hydra_vortex#498, ggml-org#733 T5b Co-Authored-By: hydra-vortex <dev@hydra>
…verbs, add libibverbs1) Also fix RUNPATH handling and glibc version note. Refs ggml-org#498
…ned ldd gate Host is Ubuntu 26.04 (glibc 2.43) but runtime base is nvidia/cuda:12.9.2-runtime-ubuntu24.04 (glibc 2.39). Host-built sm60 binaries require GLIBC_2.43 (5× version not found in image) and crash at engine start. Fix: build sm60 inside nvidia/cuda:12.9.2-devel-ubuntu24.04 (matching runtime glibc 2.39) via podman run in build-combo.sh; sm86-sm120 stays host-built (same latent issue, hardened gate now protects). Also harden ldd gate in both Dockerfile and build-combo.sh to fail on BOTH "=> not found" and "version GLIBC.*not found" (excl. libcuda/libibverbs). Refs ddvnguyen/hydra_vortex#498, lead zero-trust finding on fix498-v3 Co-Authored-By: hydra-vortex <dev@hydra>
…t/cublas) Follow-up to containerized sm60 build: host ldd on container-built binary shows libcudart/cublas => not found (expected, runtime has them via /usr/local/cuda), so gate should ignore them like libcuda. Refs ggml-org#498
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.
Fixes ddvnguyen/hydra_vortex#498 — P100 sm60 OCI image shipped executable without its shared libs.
Problem (original)
sm60 build is
BUILD_SHARED_LIBS=ON(libllama.so.0, libggml-*.so.0, libmtmd.so.0, libllama-server-impl.so for llama-server) but the OCI image built viahydra-build.Dockerfilecopied only the binary:or later
COPY bin/ /llama/without-aand without ldd verify. Deploy shipped new binary against stale.soset in/opt/software/llama-cpp-hydra-sm60/hydra-sm60/lib(empty, libs were inbin/) plus build-host RUNPATH/mnt/WorkDisk/.../build_sm60/binthat doesn't exist on VM. Result:undefined symbol: llama_model_get_quant_label(fork PR #63) and 1120-restart loop, seen in A/B baseline logs (libllama-server-impl.somissing).Fix (original)
.github/workflows/hydra-build.Dockerfile:COPY bin/ /llama/now reliably includes*.so*via staging; addARG BINARYafterFROM,RUN lddverify (fail on hydra=> not found, ignore expectedlibcuda/libibverbs),ls -lh /llama/*.so*,ENV LD_LIBRARY_PATH=/llama, and symlink fallback for both binaries (ln -sf /llama/${BINARY} /llama/llama-engine) so fixedENTRYPOINT ["/llama/llama-engine"]works for either image..github/workflows/scripts/build-combo.sh:cp -a(preserve symlinks),ls staging, hostlddcheck, warn iflibllama-server-impl.somissing forllama-serverbuilds.RUNPATH is already
$ORIGIN(-DCMAKE_BUILD_RPATH='$ORIGIN'), so/llamais the search dir;LD_LIBRARY_PATHis defensive fallback.Follow-up: glibc mismatch (lead zero-trust finding on fix498-v3)
Root cause: Host is Ubuntu 26.04 (glibc 2.43) but runtime base is
nvidia/cuda:12.9.2-runtime-ubuntu24.04(glibc 2.39). Host-built sm60 binaries requireGLIBC_2.43(5×version 'GLIBC_2.43' not foundfor libllama/libggml-base/libggml-cpu/libggml-cuda/libmtmd inldd /llama/llama-engineinside the image). The image will crash at engine start on the P100 VM. The Dockerfile's original ldd gate only grepped=> not found, so GLIBC version errors were missed.Fix (smallest correct diff, consistent with hydra-build pipeline):
=> not foundANDversion .*GLIBC.*not found(exclude only host-providedlibcuda/libibverbs/libcudart/libcublas). Addlibibverbs1toapt-get.sm60insidenvidia/cuda:12.9.2-devel-ubuntu24.04(container's own/usr/local/cuda,cmake,g++-14) to match runtime glibc 2.39. The container installscmake ninja-build ccache g++-14 libssl-dev libibverbs-dev, creates stub symlink forlibcuda.so.1, and runscmake -B build_hydra_sm60_llama-engine -G Ninja -DCMAKE_CUDA_ARCHITECTURES=60 ... -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc ...andcmake --build.sm86-sm120stays host-built (same latent glibc issue, hardened gate now protects).Alternative considered: Multi-stage Dockerfile (devel stage compiles, runtime stage ships) — equivalent correctness but larger churn to the pipeline; containerized
build-combo.shkeeps the existingcmake → staging → podman buildflow with less diff.Verify (host build, no P100 runtime change per ggml-org#733 W1)
DCUDAToolkit_ROOT=/opt/software/cuda/12.9(nvcc 12.9.86) for original, but sm60 now builds insidenvidia/cuda:12.9.2-devel-ubuntu24.04(glibc 2.39,g++-14,cmake 3.28,/usr/local/cuda/bin/nvcc).podman run -v $PWD:/work -w /work nvidia/cuda:12.9.2-devel-ubuntu24.04 bash -c 'apt-get update && apt-get install -y cmake ninja-build ccache g++-14 libssl-dev libibverbs-dev && ln -sf /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && cmake -B build_hydra_sm60_llama-engine -G Ninja -DCMAKE_CUDA_ARCHITECTURES=60 -DGGML_CUDA=ON ... -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/cuda/lib64/stubs" ... && cmake --build build_hydra_sm60_llama-engine --target llama-engine'— success,readelf -dshowsRUNPATH [$ORIGIN],stringsshows maxGLIBC_2.38(not 2.43),lddhydra libs resolve via$ORIGIN.podman build --build-arg CUDA_VERSION=12.9.2 --build-arg BINARY=llama-engine -t localhost/llama-sm60-test:fix498-glibc3 -f .github/workflows/hydra-build.Dockerfile staging_sm60_verify— 3.95GB,COPY bin/ /llama/includes all.so*,RUN lddnow passes for hydra libs and GLIBC.not foundand zero GLIBC version errors (onlylibcudaexpected host mount) — fix verified.ls -lh /llama/*.so*shows all libs.GLIBC_2.43 not found).Note on sm86/sm120: Host-built
sm86-sm120binaries (RTX 5060 Ti + 3060, CUDA 13.2) carry the same latent glibc 2.43 vs 2.39 mismatch; the hardenedgrep -E "=> not found|version .*GLIBC.*not found"gate now protects them and will fail the image build if they drift.Risk
Additive Dockerfile + build script only; no P100 VM change, no prod deploy. Image size unchanged (~3.95GB). No force-push.
Refs ddvnguyen/hydra_vortex#498, ggml-org#733 T5b