Skip to content

Commit e861fdc

Browse files
committed
[CI][C++] Add Windows ARM64 build
- Use GitHub hosted runner `windows-11-arm` to build with MSVC ARM64 - `simd-level` is set `NONE` for now as xsimd does not yet support MSVC ARM64 - `msys2` is installed and used for the timezone data, as it is not guaranteed to exist on windows-11-arm images - A recent version of `cmake` is installed as support for finding Windows OpenSSL ARM64 builds was only added in 4.1.0 (see Kitware/CMake@bf52219) - The Boost context implementation is set to `winfib` when building with MSVC ARM64 as it's the only supported implementation for that platform (see boostorg/context#296 (comment) and boostorg/context#315) - Updated ccache installation script and version to enable a Windows ARM64 native version
1 parent fc5fd48 commit e861fdc

File tree

5 files changed

+161
-26
lines changed

5 files changed

+161
-26
lines changed

.github/workflows/cpp.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ jobs:
279279
ulimit -c unlimited # must enable within the same shell
280280
ci/scripts/cpp_test.sh $(pwd) $(pwd)/build
281281
282+
# This job should be kept up-to-date with the equivalent job in cpp_extra.yml
282283
windows:
283284
name: ${{ matrix.title }}
284285
runs-on: ${{ matrix.os }}
@@ -287,12 +288,11 @@ jobs:
287288
strategy:
288289
fail-fast: false
289290
matrix:
290-
os:
291-
- windows-2022
292291
include:
293-
- os: windows-2022
292+
- arch: x64
293+
os: windows-2022
294294
simd-level: AVX2
295-
title: AMD64 Windows 2022 AVX2
295+
title: AMD64 Windows 2022 AVX2 C++
296296
env:
297297
ARROW_BOOST_USE_SHARED: OFF
298298
ARROW_BUILD_BENCHMARKS: ON
@@ -340,10 +340,17 @@ jobs:
340340
- name: Download Timezone Database
341341
shell: bash
342342
run: ci/scripts/download_tz_database.sh
343+
- name: Install msys2 (for tzdata for ORC tests)
344+
uses: msys2/setup-msys2@v2
345+
id: setup-msys2
346+
- name: Install cmake
347+
shell: bash
348+
run: |
349+
ci/scripts/install_cmake.sh 4.1.2 /usr
343350
- name: Install ccache
344351
shell: bash
345352
run: |
346-
ci/scripts/install_ccache.sh 4.6.3 /usr
353+
ci/scripts/install_ccache.sh 4.12.1 /usr
347354
- name: Setup ccache
348355
shell: bash
349356
run: |
@@ -365,14 +372,14 @@ jobs:
365372
- name: Build
366373
shell: cmd
367374
run: |
368-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
375+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
369376
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
370377
- name: Test
371378
shell: cmd
372379
run: |
373-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
380+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
374381
# For ORC
375-
set TZDIR=C:\msys64\usr\share\zoneinfo
382+
set TZDIR=${{ steps.setup-msys2.outputs.msys2-location }}\usr\share\zoneinfo
376383
bash -c "ci/scripts/cpp_test.sh $(pwd) $(pwd)/build"
377384
378385
windows-mingw:

.github/workflows/cpp_extra.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,113 @@ jobs:
313313
cd cpp/examples/minimal_build
314314
../minimal_build.build/arrow-example
315315
316+
# This job should be kept up-to-date with the equivalent job in cpp.yml
317+
windows:
318+
needs: check-labels
319+
name: ${{ matrix.title }}
320+
runs-on: ${{ matrix.os }}
321+
if: >-
322+
needs.check-labels.outputs.force == 'true' ||
323+
contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra') ||
324+
contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra: C++')
325+
timeout-minutes: 60
326+
strategy:
327+
fail-fast: false
328+
matrix:
329+
include:
330+
- arch: arm64
331+
os: windows-11-arm
332+
simd-level: NONE # Currently set to NONE because xsimd does not support MSVC ARM64 yet
333+
title: ARM64 Windows 11 C++
334+
env:
335+
ARROW_BOOST_USE_SHARED: OFF
336+
ARROW_BUILD_BENCHMARKS: ON
337+
ARROW_BUILD_SHARED: ON
338+
ARROW_BUILD_STATIC: OFF
339+
ARROW_BUILD_TESTS: ON
340+
ARROW_DATASET: ON
341+
ARROW_FLIGHT: OFF
342+
ARROW_HDFS: ON
343+
ARROW_HOME: /usr
344+
ARROW_JEMALLOC: OFF
345+
ARROW_MIMALLOC: ON
346+
ARROW_ORC: ON
347+
ARROW_PARQUET: ON
348+
ARROW_SIMD_LEVEL: ${{ matrix.simd-level }}
349+
ARROW_SUBSTRAIT: ON
350+
ARROW_USE_GLOG: OFF
351+
ARROW_VERBOSE_THIRDPARTY_BUILD: OFF
352+
ARROW_WITH_BROTLI: OFF
353+
ARROW_WITH_BZ2: OFF
354+
ARROW_WITH_LZ4: OFF
355+
ARROW_WITH_OPENTELEMETRY: OFF
356+
ARROW_WITH_SNAPPY: ON
357+
ARROW_WITH_ZLIB: ON
358+
ARROW_WITH_ZSTD: ON
359+
BOOST_SOURCE: BUNDLED
360+
CMAKE_CXX_STANDARD: "17"
361+
CMAKE_GENERATOR: Ninja
362+
CMAKE_INSTALL_PREFIX: /usr
363+
CMAKE_UNITY_BUILD: ON
364+
steps:
365+
- name: Disable Crash Dialogs
366+
run: |
367+
reg add `
368+
"HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" `
369+
/v DontShowUI `
370+
/t REG_DWORD `
371+
/d 1 `
372+
/f
373+
- name: Checkout Arrow
374+
uses: actions/checkout@v5
375+
with:
376+
fetch-depth: 0
377+
submodules: recursive
378+
- name: Download Timezone Database
379+
shell: bash
380+
run: ci/scripts/download_tz_database.sh
381+
- name: Install msys2 (for tzdata for ORC tests)
382+
uses: msys2/setup-msys2@v2
383+
id: setup-msys2
384+
- name: Install cmake
385+
shell: bash
386+
run: |
387+
ci/scripts/install_cmake.sh 4.1.2 /usr
388+
- name: Install ccache
389+
shell: bash
390+
run: |
391+
ci/scripts/install_ccache.sh 4.12.1 /usr
392+
- name: Setup ccache
393+
shell: bash
394+
run: |
395+
ci/scripts/ccache_setup.sh
396+
- name: ccache info
397+
id: ccache-info
398+
shell: bash
399+
run: |
400+
echo "cache-dir=$(ccache --get-config cache_dir)" >> $GITHUB_OUTPUT
401+
- name: Cache ccache
402+
uses: actions/cache@v4
403+
with:
404+
path: ${{ steps.ccache-info.outputs.cache-dir }}
405+
key: cpp-ccache-windows-${{ env.CACHE_VERSION }}-${{ hashFiles('cpp/**') }}
406+
restore-keys: cpp-ccache-windows-${{ env.CACHE_VERSION }}-
407+
env:
408+
# We can invalidate the current cache by updating this.
409+
CACHE_VERSION: "2022-09-13"
410+
- name: Build
411+
shell: cmd
412+
run: |
413+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
414+
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
415+
- name: Test
416+
shell: cmd
417+
run: |
418+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
419+
# For ORC
420+
set TZDIR=${{ steps.setup-msys2.outputs.msys2-location }}\usr\share\zoneinfo
421+
bash -c "ci/scripts/cpp_test.sh $(pwd) $(pwd)/build"
422+
316423
report-extra-cpp:
317424
needs:
318425
- docker

ci/scripts/install_ccache.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,19 @@ prefix=$2
3030
mkdir -p /tmp/ccache
3131
case $(uname) in
3232
MINGW64*)
33-
url="https://github.com/ccache/ccache/releases/download/v${version}/ccache-${version}-windows-x86_64.zip"
33+
declare -A archs
34+
archs=([64-bit]="x86_64"
35+
[ARM 64-bit Processor]="aarch64")
36+
arch=$(powershell -Command "(Get-CimInstance Win32_OperatingSystem).OSArchitecture")
37+
if [ -z "${archs[$arch]}" ]; then
38+
echo "Unsupported architecture on Windows: ${arch}"
39+
exit 0
40+
fi
41+
arch=${archs[$arch]}
42+
url="https://github.com/ccache/ccache/releases/download/v${version}/ccache-${version}-windows-${arch}.zip"
3443
pushd /tmp/ccache
3544
curl --fail --location --remote-name "${url}"
36-
unzip -j "ccache-${version}-windows-x86_64.zip"
45+
unzip -j "ccache-${version}-windows-${arch}.zip"
3746
chmod +x ccache.exe
3847
mv ccache.exe "${prefix}/bin/"
3948
popd

ci/scripts/install_cmake.sh

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ if [ "$#" -ne 2 ]; then
2424
exit 1
2525
fi
2626

27-
declare -A archs
28-
archs=([x86_64]=x86_64
29-
[arm64]=aarch64
30-
[aarch64]=aarch64)
27+
declare -A linux_archs
28+
linux_archs=([x86_64]="x86_64"
29+
[aarch64]="aarch64")
3130

32-
arch=$(uname -m)
33-
if [ -z "${archs[$arch]}" ]; then
34-
echo "Unsupported architecture: ${arch}"
35-
exit 0
36-
fi
37-
arch=${archs[$arch]}
31+
declare -A windows_archs
32+
windows_archs=([64-bit]="x86_64"
33+
[ARM 64-bit Processor]="arm64")
3834

3935
version=$1
4036
prefix=$2
@@ -43,12 +39,25 @@ platform=$(uname)
4339
case ${platform} in
4440
Linux)
4541
platform=linux
42+
arch=$(uname -m)
43+
if [ -z "${linux_archs[$arch]}" ]; then
44+
echo "Unsupported architecture on Linux: ${arch}"
45+
exit 0
46+
fi
47+
arch=${linux_archs[$arch]}
4648
;;
4749
Darwin)
4850
platform=macos
51+
arch=universal
4952
;;
5053
MSYS_NT*|MINGW64_NT*)
5154
platform=windows
55+
arch=$(powershell -Command "(Get-CimInstance Win32_OperatingSystem).OSArchitecture")
56+
if [ -z "${windows_archs[$arch]}" ]; then
57+
echo "Unsupported architecture on Windows: ${arch}"
58+
exit 0
59+
fi
60+
arch=${windows_archs[$arch]}
5261
;;
5362
*)
5463
echo "Unsupported platform: ${platform}"
@@ -59,22 +68,20 @@ esac
5968
mkdir -p "${prefix}"
6069
url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-"
6170
case ${platform} in
62-
macos)
63-
url+="universal.tar.gz"
64-
curl -L "${url}" | tar -xzf - --directory "${prefix}" --strip-components=1
65-
ln -s CMake.app/Contents/bin "${prefix}/bin"
66-
;;
6771
windows)
6872
url+="${arch}.zip"
6973
archive_name=$(basename "${url}")
7074
curl -L -o "${archive_name}" "${url}"
7175
unzip "${archive_name}"
7276
base_name=$(basename "${archive_name}" .zip)
73-
mv "${base_name}"/* "${prefix}"
77+
cp -a "${base_name}"/* "${prefix}"
7478
rm -rf "${base_name}" "${archive_name}"
7579
;;
7680
*)
7781
url+="${arch}.tar.gz"
7882
curl -L "${url}" | tar -xzf - --directory "${prefix}" --strip-components=1
83+
;;&
84+
macos)
85+
ln -s CMake.app/Contents/bin "${prefix}/bin"
7986
;;
8087
esac

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,11 @@ function(build_boost)
11181118
# This is for https://github.com/boostorg/container/issues/305
11191119
string(APPEND CMAKE_C_FLAGS " -Wno-strict-prototypes")
11201120
endif()
1121+
if(MSVC AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM64")
1122+
set(BOOST_CONTEXT_IMPLEMENTATION
1123+
winfib
1124+
CACHE STRING "" FORCE)
1125+
endif()
11211126
set(CMAKE_UNITY_BUILD OFF)
11221127

11231128
fetchcontent_makeavailable(boost)

0 commit comments

Comments
 (0)