Repository navigation
fix(image): provide FHS loader + lib path for manylinux wheels - #744
Merged
c-vigo merged 3 commits intoJun 29, 2026
Merged
Conversation
Add TestManylinuxRuntime to tests/test_image.py: an unconditional assertion that /lib64/ld-linux-x86-64.so.2 exists, plus a network-guarded check that numpy and pyjson5 manylinux wheels import under the baked CPython. Red against the current image, which ships no FHS loader nor C++ runtime on the loader path. Refs: #736
The pure-Nix image (Nix-but-not-NixOS) shipped neither the FHS dynamic loader /lib64/ld-linux-x86-64.so.2 that every manylinux x86_64 wheel hardcodes as its PT_INTERP, nor the Nix C++/compression runtime on the loader path. Runtime-installed PyPI binaries therefore broke: standalone tools (PyPI-pinned pre-commit ruff/typos) with "cannot execute: required file not found", and C extensions dlopened by the baked CPython (numpy, scipy, pre-commit pymarkdown's pyjson5) with "ImportError: libstdc++.so.6". Symlink the Nix glibc loader to /lib64/ld-linux-x86-64.so.2 in the bootstrap layer (newer glibc runs old-glibc wheels via backward compatibility) and bake LD_LIBRARY_PATH with stdenv.cc.cc.lib (libstdc++ /libgcc_s) + zlib (libz). The loader symlink fixes standalone wheel executables; LD_LIBRARY_PATH fixes the C-extension .so files dlopened by the store CPython, which never traverse /lib64. This is the image-scope analogue of the dev-shell #698 fix, ungated: an all-Nix container has no foreign FHS host binaries to pollute, so the /etc/NIXOS ABI gate from #698/#703 never applies. Refs: #736
…G conflict Refs: #736
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.
Summary
The pure-Nix image (Nix-but-not-NixOS) could not run pre-compiled PyPI (manylinux) wheels installed at runtime. Two gaps:
/lib64/ld-linux-x86-64.so.2(thePT_INTERPevery manylinux x86_64 wheel hardcodes) — standalone PyPI tools (consumer pre-commitruff/typos) aborted withcannot execute: required file not found.libstdc++/libgcc_s/libz) was off the loader path — C extensions dlopened by the baked CPython (numpy/scipy, pre-commitpymarkdown'spyjson5) failed withImportError: libstdc++.so.6.Fix
/lib64/ld-linux-x86-64.so.2(newer glibc runs old-glibc wheels via backward compatibility).config.Env: bakeLD_LIBRARY_PATH = makeLibraryPath [ stdenv.cc.cc.lib zlib ].The loader symlink fixes standalone wheel executables;
LD_LIBRARY_PATHfixes the C-extension.sofiles dlopened by the store CPython, which never traverse/lib64(so the loader symlink alone is insufficient). This is the image-scope analogue of the dev-shell #698 fix, but ungated: an all-Nix container has no foreign FHS host binaries to pollute, so the/etc/NIXOSABI gate from #698/#703 never applies. nix-ld was evaluated but is redundant here — the mandatory globalLD_LIBRARY_PATH(needed for the dlopen path nix-ld cannot intercept) already lets a plain glibc-loader symlink cover the standalone-executable case, with a smaller closure.Verification
Built
:test-736, then inside the image:ls -l /lib64/ld-linux-x86-64.so.2→ symlink to the Nix glibc loader ✓numpy 2.5.0imports (manylinux wheel, C-ext dlopen) ✓pyjson5 OK(the exact pre-commitpymarkdownfailure) ✓ruff 0.15.20runs (standalone manylinux executable via the/lib64loader) ✓pytest tests/test_image.py::TestManylinuxRuntime→ 3 passedNew
tests/test_image.py::TestManylinuxRuntimeasserts the loader exists (unconditional) and thatnumpy/pyjson5wheels import under the baked CPython (network-guarded, skips offline).Closes #736