Skip to content

Commit

Permalink
Downgrade arm cross compile toolchain to glibc 2.34 (#7153)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoy committed Mar 7, 2024
1 parent 364da19 commit e873664
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
12 changes: 2 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ jobs:
vmImage: "ubuntu-latest"
container: "quay.io/pypa/manylinux2014_x86_64:latest"
steps:
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz?rev=22c39fc25e5541818967b4ff5a09ef3e&hash=E7676169CE35FC2AAECF4C121E426083871CA6E5'
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz?rev=33c6e30e5ac64e6dba8f0431f2c35f1b&hash=9918A05BF47621B632C7A5C8D2BB438FB80A4480'
- script: mkdir -p /tmp/arm-toolchain/
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin'
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin'
- script: echo $PATH
- script: stat /tmp/arm-toolchain/bin/aarch64-none-linux-gnu-gcc
- task: PythonScript@0
Expand All @@ -65,15 +66,6 @@ jobs:
scriptPath: scripts/mk_unix_dist.py
arguments: --nodotnet --nojava --arch=arm64
pythonInterpreter: $(python)
- script: git clone https://github.com/z3prover/z3test z3test
displayName: 'Clone z3test'
- task: PythonScript@0
displayName: Test
inputs:
scriptSource: 'filepath'
scriptPath: z3test/scripts/test_benchmarks.py
arguments: build-dist/z3 z3test/regressions/smt2
pythonInterpreter: $(python)
- task: CopyFiles@2
inputs:
sourceFolder: dist
Expand Down
20 changes: 18 additions & 2 deletions scripts/mk_unix_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,22 @@ def mk_z3():
return 1

def get_os_name():
global LINUX_X64
if OS_NAME is not None:
return OS_NAME
import platform
basic = os.uname()[0].lower()
if basic == 'linux':
dist = platform.libc_ver()
if mk_util.IS_ARCH_ARM64 and LINUX_X64:
# handle cross compiling
# example: 'ldd (GNU) 2.34'
lines = subprocess.check_output(["ldd", "--version"]).decode('ascii')
first_line = lines.split("\n")[0]
ldd_version = first_line.split()[-1]
# coerce the format to platform.libc_ver() return type
dist = ('glibc', ldd_version)
else:
dist = platform.libc_ver()
if len(dist) == 2 and len(dist[0]) > 0 and len(dist[1]) > 0:
return '%s-%s' % (dist[0].lower(), dist[1].lower())
else:
Expand All @@ -199,8 +209,14 @@ def get_os_name():
return basic

def get_z3_name():
import platform as platform_module
# Note that the platform name this function return
# has to work together with setup.py
# It's not the typical output from platform.machine()
major, minor, build, revision = get_version()
if mk_util.IS_ARCH_ARM64:
if mk_util.IS_ARCH_ARM64 or platform_module.machine() == "aarch64":
# the second case handle native build on aarch64
# TODO: we don't handle cross compile on host aarch64 to target x64
platform = "arm64"
elif sys.maxsize >= 2**32:
platform = "x64"
Expand Down
3 changes: 2 additions & 1 deletion scripts/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ stages:
vmImage: "ubuntu-latest"
container: "quay.io/pypa/manylinux2014_x86_64:latest"
steps:
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz?rev=22c39fc25e5541818967b4ff5a09ef3e&hash=E7676169CE35FC2AAECF4C121E426083871CA6E5'
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz?rev=33c6e30e5ac64e6dba8f0431f2c35f1b&hash=9918A05BF47621B632C7A5C8D2BB438FB80A4480'
- script: mkdir -p /tmp/arm-toolchain/
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin'
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin'
- script: echo $PATH
- script: stat /tmp/arm-toolchain/bin/aarch64-none-linux-gnu-gcc
- task: PythonScript@0
Expand Down

0 comments on commit e873664

Please sign in to comment.