Repository navigation
Description
Problem
The embedded-CPython python_facades test binary links to the uv-managed libpython, but the Linux dynamic loader cannot find it when the test is invoked directly. On a local Linux checkout, soldr cargo test -p fbuild-python --test python_facades -- --ignored exits 127 before any test runs:
error while loading shared libraries: libpython3.13.so.1.0: cannot open shared object file: No such file or directory
ldd target/debug/deps/python_facades-* reports libpython3.13.so.1.0 => not found; readelf -d shows a RUNPATH for the toolchain libraries but not the uv Python lib directory. The library exists under the uv-managed interpreter. This is a test-binary runtime-loader setup issue, not a serial-session failure or a Rust link error.
The python-facade-tests job in .github/workflows/check-ubuntu.yml explicitly resolves the pinned Python 3.10 LIBDIR and writes LD_LIBRARY_PATH to GITHUB_ENV before running the test. crates/fbuild-python/tests/README.md documents a similar manual export for local runs, but the ordinary approved soldr cargo test ... invocation does not provide it. The README also uses python3 for LIBDIR while PYO3_PYTHON can point to a different interpreter, which can silently select the wrong library directory.
Expected behavior / proposed scope
Provide one reproducible, interpreter-consistent way to run the embedded-CPython facade tests locally and in CI without manually discovering and exporting a separate library path. Resolve LIBDIR from the exact PYO3_PYTHON selected for the build, preserve any existing loader path, and keep this setup scoped to the embedded-Python test runner (not global Rust builds). A test-runner wrapper, stable test binary runpath, or an equivalent approach is acceptable; choose the least invasive portable option. Update the test README and CI job to use the same approach where practical.
Acceptance
- RED: On Linux with a uv-managed shared Python whose
libdirectory is outside default loader paths, the direct test invocation fails before tests start with the missinglibpythonerror. - GREEN: The documented local test command/test-runner starts and runs
python_facadeswithout a user-authoredLD_LIBRARY_PATHexport, using the same interpreter for PyO3 and library lookup. - CI's pinned-Python facade job still runs the ignored tests, and existing
LD_LIBRARY_PATHentries are preserved. - Add a focused check or test for interpreter/path selection so a future Python-version mismatch is caught.
Decisions
- Priority: P2 developer-test reliability; CI currently has a workaround.
- This issue covers embedded-CPython test execution only. It does not change the production extension-module loader or the unrelated QEMU
LD_LIBRARY_PATHpath. - No matching existing issue was found by searching open and closed issues for
libpython,LD_LIBRARY_PATH, andpython_facades(issue Should serial monitor be fully async? Shared session core; promote AsyncSerialMonitor out of experimental #1485 is the parent feature only).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
zackees commentedon Sep 26, 2026
CI evidence from PR #1490: after installing managed Python 3.10 and setting LD_LIBRARY_PATH to its LIBDIR, the embedded-CPython test binary loads libpython but Python startup still searches /install/lib/python3.10 and fails with ModuleNotFoundError: No module named 'encodings'. The runner also needs PYTHONHOME set to the selected interpreter's sys.prefix; the PR now sets both loader and runtime paths. This shows the issue is not only the dynamic linker path.
fix(python): bake PYO3_PYTHON libdir into facade test RUNPATH (#1487) (…