Skip to content

Conversation

mayeut
Copy link
Member

@mayeut mayeut commented Aug 24, 2025

This PR uses a statically built Clang in order to enable "cross-compilation" although seen from all scripts, this behaves as a native compilation.
A full build that was taking more than 5 hours with QEMU takes less than 2 hours with this cross-compilation method.

Given CPython has different support level for gcc than clang, we do respect this when building CPython, the default is as follows:

  • use Clang to build all libraries/tools when the build machine is x86_64/aarch64 (this is was we use on GHA)
  • use GCC to build CPython if GCC has a higher level of support according to PEP11, otherwise, use Clang

Everything can be overridden.

This only configurations that are still too slow and are left on Travis CI are manylinux s390x images for which CPython only has some level of support when using GCC.

Clang used in this PR is built & published in the following: repo https://github.com/mayeut/static-clang-images

@mayeut mayeut requested a review from Copilot August 24, 2025 10:48
Copilot

This comment was marked as outdated.

@mayeut mayeut requested a review from Copilot August 24, 2025 11:45
Copilot

This comment was marked as outdated.

@mayeut mayeut requested a review from Copilot August 25, 2025 04:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements cross-compilation using statically built Clang to significantly improve build performance, reducing full build time from over 5 hours to less than 2 hours. The changes introduce Clang-based cross-compilation while respecting CPython's compiler support tiers according to PEP11.

  • Adds static Clang toolchain integration with configurable cross-compilation support
  • Updates build scripts to use the cross-compiler entrypoint instead of native compilation
  • Migrates some builds from Travis CI to GitHub Actions for better performance

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docker/build_scripts/install-clang-static.sh New script that sets up static Clang toolchain with target-specific configuration
docker/build_scripts/install-libxcrypt.sh Adds conditional linker flag override for Clang compatibility
docker/build_scripts/build-openssl.sh Adds libatomic linking for i686 and disables afalgeng
docker/build_scripts/build-cpython.sh Updates linker flags and removes x86-64 specific optimizations
docker/Dockerfile Integrates static Clang toolchain and updates all build steps to use cross-compilation
build.sh Adds logic to determine when to enable/disable Clang based on architecture and PEP11
.travis.yml Removes some builds that are now handled by GitHub Actions
.github/workflows/build.yml Adds ppc64le and s390x builds and configures QEMU for additional architectures

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mayeut mayeut marked this pull request as ready for review August 25, 2025 05:09
Copilot

This comment was marked as outdated.

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