Skip to content

Fix embedded-Python facade test runtime loader path for uv libpython #1487

Description

@zackees

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 lib directory is outside default loader paths, the direct test invocation fails before tests start with the missing libpython error.
  • GREEN: The documented local test command/test-runner starts and runs python_facades without a user-authored LD_LIBRARY_PATH export, using the same interpreter for PyO3 and library lookup.
  • CI's pinned-Python facade job still runs the ignored tests, and existing LD_LIBRARY_PATH entries are preserved.
  • Add a focused check or test for interpreter/path selection so a future Python-version mismatch is caught.

Decisions

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions