Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-115382: Fix cross compiles when host and target use same SOABI #116294

Merged
merged 3 commits into from
Oct 16, 2024

Commits on Apr 2, 2024

  1. pythongh-115382: Fix cross compiles when host and target use same SOABI

    Previously, when a build was configured to use a host interpreter via
    --with-build-python, the PYTHON_FOR_BUILD config value included a path
    in PYTHONPATH that pointed to the target's built external modules.
    
    For "normal" foreign architecture cross compiles, when loading compiled
    external libraries, the target libraries were processed first due to
    their precedence in sys.path. These libraries were then ruled out due to
    a mismatch in the SOABI so the import mechanism continued searching
    until it found the host's native modules.
    
    However, if the host interpreter and the target python were on the same
    version + SOABI combination, the host interpreter would attempt to load
    the target's external modules due to their precedence in sys.path.
    
    Despite the "match", the target build may have been linked against a
    different libc or may include unsupported instructions so loading or
    executing the target's external modules can lead to crashes.
    
    Now, the path to the target's external modules is no longer defined in
    PYTHONPATH to prevent accidentally loading these foreign modules.
    
    One caveat is that during certain build stages, the target's sysconfig
    module requires higher precedence than the host's version in order to
    accurately query the target build's configuration.
    
    This worked previously due to the target's sysconfig data module having
    precedence over the host's (see above). In order to keep this desired
    behavior, a new environment variable, _PYTHON_SYSCONFIGDATA_PATH, has
    been defined so sysconfig can search this directory for the target's
    sysconfig data.
    
    Signed-off-by: Vincent Fazio <vfazio@gmail.com>
    vfazio committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    68e931a View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. Configuration menu
    Copy the full SHA
    d27e911 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2024

  1. Configuration menu
    Copy the full SHA
    a9fae43 View commit details
    Browse the repository at this point in the history