Skip to content

conda-forge libpython never preloaded; libjep RUNPATH, README and LD_PRELOAD advice after #93 #96

Open

Description

@morisil

Left after the review of the fix for #93 (PR for #93, stacked on #94).

  1. conda-forge: libpython is never preloaded, and no advice is given.
    conda-forge's Python reports INSTSONAME (and LDLIBRARY) as libpython3.X.a, so pythonLibrary() returns null and nothing reaches the preload or the startup advice —
    while a pip-built Jep there links to libpython3.X.so.1.0 without a RUNPATH, so it likely fails without LD_LIBRARY_PATH (not verified end to end).
    Finding the shared library for a static soname must not risk a wrong "found".
  2. A libjep with DT_RPATH/DT_RUNPATH (e.g. a conda build) can resolve a different libpython than loaderFinds predicts — treat any RPATH/RUNPATH in libjep as "not found" (the file is already read by jepLibraryName).
  3. README (around the libpython section) still says the loader searches "the system ones", and gives LD_LIBRARY_PATH or the development package as the Java 17–21 remedy — the static (LD_PRELOAD) case and the conservative preloads of loaderFinds mispredicts the loader: empty LD_LIBRARY_PATH entry, musl/hwcaps dirs, static LDLIBRARY #93 are not described.
  4. The LD_PRELOAD advice for an empty Jep name claims "Jep does not make its symbols global with this Python" also when the name is only uncertain (unreadable libjep, two candidates), and LD_PRELOAD is inherited by processes the JVM starts (the probe, pip) — word it conditionally and scope it to the JVM.
  5. Polish: jepLibraryName reads and scans the whole libjep (~400 KB) on every Linux start, before the cheap soname check which usually decides — compute it lazily; the test "does not find libpython only in directory it might not search by default" passes trivially (cache = { null }).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions