Skip to content

gh-119696: Use RUNPATH for relocatable builds (alternative) - #49

Draft
zaniebot wants to merge 1 commit into
zb/relocatable-flag-iifrom
zb/relocatable-flag-ii-runpath
Draft

zaniebot wants to merge 1 commit into
zb/relocatable-flag-iifrom
zb/relocatable-flag-ii-runpath

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

PBS rewrites installed binaries to give them relative library paths. Supply relative paths during linking under --enable-relocatable, for interpreters, libpython, and standard-library extensions on Linux and non-framework macOS. Keep installed-layout flags out of LDSHARED, since third-party extensions can be installed elsewhere. Importing build-tree extensions may require additional loader search paths for non-system dependencies.

This alternative to #48 uses DT_RUNPATH on Linux. On glibc, LD_LIBRARY_PATH can override those paths, so the build tree can select its own libpython while sharing binaries with the installation. The ordinary BOLT rules optimize the binaries that will be installed, so this design does not need the additional profile application in #56. DT_RUNPATH is not inherited for indirect dependencies: distributors bundling those dependencies outside the system search paths need suitable paths on the libraries that require them. This trades PBS's inherited DT_RPATH lookup for environment overrides and fewer link outputs. macOS uses an @rpath install name with relative search paths.

The experimental mode requires default bin and lib directories under a common prefix and rejects framework builds until framework relocation is implemented. The standard library may use a different directory through --with-platlibdir, so extension paths traverse back to the prefix before entering lib. The added search paths point to lib; dependencies in subdirectories such as lib/tcltk may need additional search paths. Tcl/Tk script discovery is separate from shared-library lookup. Dependency bundling and rewriting shebangs or sysconfig paths remain separate concerns.

The base branch contains the flag proposed in python#160377 and the independent deleted-library fixture fix proposed in python#160396 for python#160388. Related relocation proposal: python#119696; downstream backport draft: astral-sh/python-build-standalone#861.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant