Skip to content

Commit e873664

Browse files
authored
Downgrade arm cross compile toolchain to glibc 2.34 (#7153)
1 parent 364da19 commit e873664

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

azure-pipelines.yml

+2-10
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ jobs:
5252
vmImage: "ubuntu-latest"
5353
container: "quay.io/pypa/manylinux2014_x86_64:latest"
5454
steps:
55-
- 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'
55+
- 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'
5656
- script: mkdir -p /tmp/arm-toolchain/
5757
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1
5858
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin'
59+
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin'
5960
- script: echo $PATH
6061
- script: stat /tmp/arm-toolchain/bin/aarch64-none-linux-gnu-gcc
6162
- task: PythonScript@0
@@ -65,15 +66,6 @@ jobs:
6566
scriptPath: scripts/mk_unix_dist.py
6667
arguments: --nodotnet --nojava --arch=arm64
6768
pythonInterpreter: $(python)
68-
- script: git clone https://github.com/z3prover/z3test z3test
69-
displayName: 'Clone z3test'
70-
- task: PythonScript@0
71-
displayName: Test
72-
inputs:
73-
scriptSource: 'filepath'
74-
scriptPath: z3test/scripts/test_benchmarks.py
75-
arguments: build-dist/z3 z3test/regressions/smt2
76-
pythonInterpreter: $(python)
7769
- task: CopyFiles@2
7870
inputs:
7971
sourceFolder: dist

scripts/mk_unix_dist.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,22 @@ def mk_z3():
171171
return 1
172172

173173
def get_os_name():
174+
global LINUX_X64
174175
if OS_NAME is not None:
175176
return OS_NAME
176177
import platform
177178
basic = os.uname()[0].lower()
178179
if basic == 'linux':
179-
dist = platform.libc_ver()
180+
if mk_util.IS_ARCH_ARM64 and LINUX_X64:
181+
# handle cross compiling
182+
# example: 'ldd (GNU) 2.34'
183+
lines = subprocess.check_output(["ldd", "--version"]).decode('ascii')
184+
first_line = lines.split("\n")[0]
185+
ldd_version = first_line.split()[-1]
186+
# coerce the format to platform.libc_ver() return type
187+
dist = ('glibc', ldd_version)
188+
else:
189+
dist = platform.libc_ver()
180190
if len(dist) == 2 and len(dist[0]) > 0 and len(dist[1]) > 0:
181191
return '%s-%s' % (dist[0].lower(), dist[1].lower())
182192
else:
@@ -199,8 +209,14 @@ def get_os_name():
199209
return basic
200210

201211
def get_z3_name():
212+
import platform as platform_module
213+
# Note that the platform name this function return
214+
# has to work together with setup.py
215+
# It's not the typical output from platform.machine()
202216
major, minor, build, revision = get_version()
203-
if mk_util.IS_ARCH_ARM64:
217+
if mk_util.IS_ARCH_ARM64 or platform_module.machine() == "aarch64":
218+
# the second case handle native build on aarch64
219+
# TODO: we don't handle cross compile on host aarch64 to target x64
204220
platform = "arm64"
205221
elif sys.maxsize >= 2**32:
206222
platform = "x64"

scripts/nightly.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ stages:
203203
vmImage: "ubuntu-latest"
204204
container: "quay.io/pypa/manylinux2014_x86_64:latest"
205205
steps:
206-
- 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'
206+
- 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'
207207
- script: mkdir -p /tmp/arm-toolchain/
208208
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1
209209
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin'
210+
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin'
210211
- script: echo $PATH
211212
- script: stat /tmp/arm-toolchain/bin/aarch64-none-linux-gnu-gcc
212213
- task: PythonScript@0

0 commit comments

Comments
 (0)