From 21fb016272a75b90fa7882bcdb9ad15e8f4d3ee3 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Mon, 12 Aug 2024 21:40:05 +0800 Subject: [PATCH] build: fix build regression related to auditwheel>=6.1.0 The latest auditwheel has added riscv64 manylinux ABI support, but our build environment (and support baseline) is more recent than that, causing our riscv64 builds to fail. For now, just probe for auditwheel >= 6.1.0 and override the platform tag if necessary. The pygit2 build always downloads the most recent auditwheel, so unconditionally apply the platform tag override for it. Link: https://github.com/pypa/auditwheel/pull/504 --- scripts/build-pygit2.py | 5 +++++ scripts/build-xingque.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/scripts/build-pygit2.py b/scripts/build-pygit2.py index 10eaf88..8537461 100755 --- a/scripts/build-pygit2.py +++ b/scripts/build-pygit2.py @@ -173,6 +173,11 @@ def get_pygit2_wheel_build_env(pygit2_dir: str) -> dict[str, str]: # this is unnecessary del r["LIBGIT2"] + # auditwheel 6.1.0+ has manylinux policies for riscv64, but the default + # is too low for our environment + # bump it up + r["AUDITWHEEL_PLAT"] = "manylinux_2_35_riscv64" + return r diff --git a/scripts/build-xingque.py b/scripts/build-xingque.py index f11819d..36c5a12 100755 --- a/scripts/build-xingque.py +++ b/scripts/build-xingque.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os +import platform import shutil import subprocess import sys @@ -114,6 +115,21 @@ def build_xingque(xingque_ver: str, workdir: str) -> str: log(f"unpacking {xingque_src_filename}") subprocess.run(("tar", "-xf", xingque_src_filename), cwd=workdir, check=True) + # auditwheel 6.1.0+ has manylinux policies for riscv64, but the default + # is too low for our environment + # bump it up if that's the case + # the output looks like "auditwheel 6.1.0 installed ..." + auditwheel_ver_str = subprocess.check_output( + ["auditwheel", "--version"], + encoding="utf-8", + ).split(" ")[1] + auditwheel_ver = [int(x) for x in auditwheel_ver_str.split(".", 2)[:2]] + if platform.machine() == "riscv64": + if auditwheel_ver[0] > 6 or (auditwheel_ver[0] == 6 and auditwheel_ver[1] >= 1): + manylinux_plat = "manylinux_2_35_riscv64" + log(f"using manylinux platform tag: {manylinux_plat}") + os.environ["AUDITWHEEL_PLAT"] = manylinux_plat + # build wheel log("building xingque wheel", group=True) subprocess.run( @@ -121,6 +137,7 @@ def build_xingque(xingque_ver: str, workdir: str) -> str: cwd=xingque_workdir, check=True, ) + maturin_out_path = os.path.join(xingque_workdir, "target", "wheels") tmp_wheel_path = os.path.join( maturin_out_path,