diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c0c21bd02..3b70b5f83 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -60,9 +60,6 @@ jobs: - build.cross - build.cross-riscv64 - gcc - - xcb - - xcb.cross - - xcb.cross-riscv64 name: ${{ matrix.image }} runs-on: depot-ubuntu-22.04 permissions: diff --git a/cpython-unix/Makefile b/cpython-unix/Makefile index 2413d7a15..4cacaff3c 100644 --- a/cpython-unix/Makefile +++ b/cpython-unix/Makefile @@ -70,6 +70,8 @@ PYTHON_DEP_DEPENDS := \ $(TOOLCHAIN_DEPENDS) \ $(NULL) +HOST_PYTHON_DEPENDS := $(OUTDIR)/cpython-$(PYTHON_MAJOR_VERSION)-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(HOST_PLATFORM).tar + default: $(OUTDIR)/cpython-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(PACKAGE_SUFFIX).tar ifndef PYBUILD_NO_DOCKER @@ -149,8 +151,8 @@ $(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXAU_DEPENDS) LIBXCB_DEPENDS = \ $(PYTHON_DEP_DEPENDS) \ + $(HOST_PYTHON_DEPENDS) \ $(HERE)/build-libxcb.sh \ - $(OUTDIR)/image-$(DOCKER_IMAGE_XCB).tar \ $(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar \ $(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar \ $(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar \ @@ -158,7 +160,7 @@ LIBXCB_DEPENDS = \ $(NULL) $(OUTDIR)/libxcb-$(LIBXCB_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXCB_DEPENDS) - $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) libxcb + $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) libxcb $(OUTDIR)/m4-$(M4_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-m4.sh $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) m4 @@ -204,13 +206,14 @@ $(OUTDIR)/tix-$(TIX_VERSION)-$(PACKAGE_SUFFIX).tar: $(TIX_DEPENDS) $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) tix TK_DEPENDS = \ + $(HOST_PYTHON_DEPENDS) \ $(HERE)/build-tk.sh \ $(OUTDIR)/tcl-$(TCL_VERSION)-$(PACKAGE_SUFFIX).tar \ $(if $(NEED_LIBX11),$(OUTDIR)/libX11-$(LIBX11_VERSION)-$(PACKAGE_SUFFIX).tar) \ $(NULL) $(OUTDIR)/tk-$(TK_VERSION)-$(PACKAGE_SUFFIX).tar: $(TK_DEPENDS) - $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) tk + $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) tk $(OUTDIR)/uuid-$(UUID_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-uuid.sh $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) uuid @@ -218,8 +221,8 @@ $(OUTDIR)/uuid-$(UUID_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HE $(OUTDIR)/x11-util-macros-$(X11_UTIL_MACROS_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-x11-util-macros.sh $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) x11-util-macros -$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xcb-proto.sh - $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) xcb-proto +$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HOST_PYTHON_DEPENDS) $(HERE)/build-xcb-proto.sh + $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) xcb-proto $(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xorgproto.sh $(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) xorgproto diff --git a/cpython-unix/base.Dockerfile b/cpython-unix/base.Dockerfile index 580165504..7e666e045 100644 --- a/cpython-unix/base.Dockerfile +++ b/cpython-unix/base.Dockerfile @@ -29,10 +29,6 @@ RUN for s in debian_jessie debian_jessie-updates debian-security_jessie/updates; echo 'Acquire::Retries "5";'; \ ) > /etc/apt/apt.conf.d/99cpython-portable -RUN ( echo 'amd64'; \ - echo 'i386'; \ - ) > /var/lib/dpkg/arch - # apt iterates all available file descriptors up to rlim_max and calls # fcntl(fd, F_SETFD, FD_CLOEXEC). This can result in millions of system calls # (we've seen 1B in the wild) and cause operations to take seconds to minutes. diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 73fb8c451..fcf469ec1 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -91,6 +91,9 @@ fi # Configure nerfs RUNSHARED when cross-compiling, which prevents PGO from running when # we can in fact run the target binaries (e.g. x86_64 host and i686 target). Undo that. +# TODO this may not be needed after removing support for i686 builds. But it +# may still be useful since CPython's definition of cross-compiling has historically +# been very liberal and kicks in when it arguably shouldn't. if [ -n "${CROSS_COMPILING}" ]; then if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]; then patch -p1 -i ${ROOT}/patch-dont-clear-runshared-14.patch @@ -1058,9 +1061,6 @@ armv7-unknown-linux-gnueabi) armv7-unknown-linux-gnueabihf) PYTHON_ARCH="arm-linux-gnueabihf" ;; -i686-unknown-linux-gnu) - PYTHON_ARCH="i386-linux-gnu" - ;; mips-unknown-linux-gnu) PYTHON_ARCH="mips-linux-gnu" ;; diff --git a/cpython-unix/build-libX11.sh b/cpython-unix/build-libX11.sh index e8f65ad45..bb45028bb 100755 --- a/cpython-unix/build-libX11.sh +++ b/cpython-unix/build-libX11.sh @@ -54,9 +54,6 @@ if [ -n "${CROSS_COMPILING}" ]; then armv7-unknown-linux-gnueabihf) EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" ;; - i686-unknown-linux-gnu) - EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" - ;; mips-unknown-linux-gnu) EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" ;; @@ -81,9 +78,6 @@ if [ -n "${CROSS_COMPILING}" ]; then aarch64-unknown-linux-musl) EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" ;; - i686-unknown-linux-musl) - EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" - ;; mips-unknown-linux-musl) EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull" ;; diff --git a/cpython-unix/build-xcb-proto.sh b/cpython-unix/build-xcb-proto.sh index 21e8c2e4e..5ac092a2a 100755 --- a/cpython-unix/build-xcb-proto.sh +++ b/cpython-unix/build-xcb-proto.sh @@ -12,7 +12,7 @@ pkg-config --version export PATH=/tools/${TOOLCHAIN}/bin:/tools/host/bin:$PATH export PKG_CONFIG_PATH=/tools/deps/share/pkgconfig -tar -xf xcb-proto-${XCB_PROTO_VERSION}.tar.gz +tar -xf xcb-proto-${XCB_PROTO_VERSION}.tar.xz pushd xcb-proto-${XCB_PROTO_VERSION} CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" LDFLAGS="${EXTRA_TARGET_LDFLAGS}" ./configure \ diff --git a/cpython-unix/build.Dockerfile b/cpython-unix/build.Dockerfile index 09e37faba..e44d0a2e2 100644 --- a/cpython-unix/build.Dockerfile +++ b/cpython-unix/build.Dockerfile @@ -1,8 +1,5 @@ {% include 'base.Dockerfile' %} -# libc6-dev:i386 pulls in 32-bit system libraries to enable cross-compiling -# to i386. -# # libffi-dev and zlib1g-dev are present so host Python (during cross-builds) # can build the ctypes and zlib extensions. So comment in build-cpython.sh # for more context. @@ -14,7 +11,6 @@ RUN ulimit -n 10000 && apt-get install \ bzip2 \ file \ libc6-dev \ - libc6-dev:i386 \ libffi-dev \ make \ patch \ diff --git a/cpython-unix/build.py b/cpython-unix/build.py index 05783fe82..6829e9101 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -246,6 +246,7 @@ def simple_build( dest_archive, extra_archives=None, tools_path="deps", + python_host_version=None, ): archive = download_entry(entry, DOWNLOADS_PATH) @@ -264,6 +265,15 @@ def simple_build( for a in extra_archives or []: build_env.install_artifact_archive(BUILD, a, target_triple, build_options) + if python_host_version: + majmin = ".".join(python_host_version.split(".")[0:2]) + build_env.install_toolchain_archive( + BUILD, + f"cpython-{majmin}", + host_platform, + version=python_host_version, + ) + build_env.copy_file(archive) build_env.copy_file(SUPPORT / ("build-%s.sh" % entry)) @@ -796,6 +806,7 @@ def build_cpython( for p in sorted(packages): build_env.install_artifact_archive(BUILD, p, target_triple, build_options) + # Install the host CPython. build_env.install_toolchain_archive( BUILD, entry_name, host_platform, version=python_version ) @@ -1032,6 +1043,11 @@ def main(): default=None, help="A custom path to CPython source files to use", ) + parser.add_argument( + "--python-host-version", + default=None, + help="Python X.Y version for host Python installation", + ) parser.add_argument("action") args = parser.parse_args() @@ -1047,6 +1063,8 @@ def main(): dest_archive = pathlib.Path(args.dest_archive) docker_image = args.docker_image + python_host_version = args.python_host_version + settings = get_target_settings(TARGETS_CONFIG, target_triple) if args.action == "dockerfiles": @@ -1213,6 +1231,7 @@ def main(): target_triple=target_triple, build_options=build_options, dest_archive=dest_archive, + python_host_version=python_host_version, ) elif action == "libxcb": @@ -1226,6 +1245,7 @@ def main(): build_options=build_options, dest_archive=dest_archive, extra_archives={"libpthread-stubs", "libXau", "xcb-proto", "xorgproto"}, + python_host_version=python_host_version, ) elif action == "tix": @@ -1260,6 +1280,7 @@ def main(): build_options=build_options, dest_archive=dest_archive, extra_archives=extra_archives, + python_host_version=python_host_version, ) elif action.startswith("cpython-") and action.endswith("-host"): diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index c52078573..028eadde5 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -249,7 +249,6 @@ _decimal: - define: CONFIG_32=1 targets: - armv7-.* - - i686-.* - mips-.* - mipsel-.* - define: CONFIG_64=1 @@ -299,7 +298,6 @@ _hashlib: # a static library so there isn't a runtime dependency. - name: ':libatomic.a' targets: - - i686-unknown-linux-gnu - mips-unknown-linux-gnu - mipsel-unknown-linux-gnu - x86_64.*-unknown-linux-gnu @@ -570,7 +568,6 @@ _ssl: # a static library so there isn't a runtime dependency. - name: ':libatomic.a' targets: - - i686-unknown-linux-gnu - mips-unknown-linux-gnu - mipsel-unknown-linux-gnu - x86_64.*-unknown-linux-gnu diff --git a/cpython-unix/targets.yml b/cpython-unix/targets.yml index 46a92e31e..1b47dba4b 100644 --- a/cpython-unix/targets.yml +++ b/cpython-unix/targets.yml @@ -318,52 +318,6 @@ armv7-unknown-linux-gnueabihf: - zlib openssl_target: linux-armv4 -i686-unknown-linux-gnu: - host_platforms: - - linux_x86_64 - pythons_supported: - - '3.9' - - '3.10' - - '3.11' - - '3.12' - - '3.13' - - '3.14' - needs_toolchain: true - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-m32' - - '-fvisibility=hidden' - target_ldflags: - - '-m32' - needs: - - autoconf - - bdb - - binutils - - bzip2 - - expat - - libedit - - libffi - - libX11 - - libXau - - libxcb - - m4 - - mpdecimal - - ncurses - - openssl-3.0 - - patchelf - - sqlite - - tcl - - tk - - tix - - uuid - - xorgproto - - xz - - zlib - openssl_target: linux-x86-clang - mips-unknown-linux-gnu: host_platforms: - linux_x86_64 diff --git a/cpython-unix/xcb.Dockerfile b/cpython-unix/xcb.Dockerfile deleted file mode 100644 index 33d350e23..000000000 --- a/cpython-unix/xcb.Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -{% include 'build.Dockerfile' %} -RUN ulimit -n 10000 && apt-get install \ - python diff --git a/cpython-unix/xcb.cross-riscv64.Dockerfile b/cpython-unix/xcb.cross-riscv64.Dockerfile deleted file mode 100644 index 260aa7d7e..000000000 --- a/cpython-unix/xcb.cross-riscv64.Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -{% include 'build.cross-riscv64.Dockerfile' %} -RUN apt-get install \ - python diff --git a/cpython-unix/xcb.cross.Dockerfile b/cpython-unix/xcb.cross.Dockerfile deleted file mode 100644 index cc003ff2a..000000000 --- a/cpython-unix/xcb.cross.Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -{% include 'build.cross.Dockerfile' %} -RUN apt-get install \ - python diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index c6fd22146..12abd7aed 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -156,13 +156,11 @@ "licenses": ["MIT"], "license_file": "LICENSE.libXau.txt", }, - # Newer versions of libxcb require a modern Python to build. We can take this - # dependency once we feel like doing the work. "libxcb": { - "url": "https://xcb.freedesktop.org/dist/libxcb-1.14.tar.gz", - "size": 640322, - "sha256": "2c7fcddd1da34d9b238c9caeda20d3bd7486456fc50b3cc6567185dbd5b0ad02", - "version": "1.14", + "url": "https://xcb.freedesktop.org/dist/libxcb-1.17.0.tar.gz", + "size": 661593, + "sha256": "2c69287424c9e2128cb47ffe92171e10417041ec2963bceafb65cb3fcf8f0b85", + "version": "1.17.0", "library_names": ["xcb"], "licenses": ["MIT"], "license_file": "LICENSE.libxcb.txt", @@ -380,10 +378,10 @@ "version": "1.20.1", }, "xcb-proto": { - "url": "https://www.x.org/archive/individual/proto/xcb-proto-1.14.1.tar.gz", - "size": 194674, - "sha256": "85cd21e9d9fbc341d0dbf11eace98d55d7db89fda724b0e598855fcddf0944fd", - "version": "1.14.1", + "url": "https://xcb.freedesktop.org/dist/xcb-proto-1.17.0.tar.xz", + "size": 151748, + "sha256": "2c1bacd2110f4799f74de6ebb714b94cf6f80fb112316b1219480fd22562148c", + "version": "1.17.0", }, # Newer versions from at least 2023 have build failures for reasons we haven't # fully investigated. diff --git a/pythonbuild/utils.py b/pythonbuild/utils.py index 1c4f4ffc4..3df0f7839 100644 --- a/pythonbuild/utils.py +++ b/pythonbuild/utils.py @@ -195,7 +195,6 @@ def write_triples_makefiles( image_suffix = settings.get("docker_image_suffix", "") lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix) - lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix) entry = clang_toolchain(host_platform, triple) lines.append(