Skip to content

Commit 8dd9eba

Browse files
authored
GH-47196: [CI][C++] Add Windows ARM64 build (#47811)
### Rationale for this change This PR adds a CI job to test building the C++ library on Windows ARM64 with MSVC, which will help ensuring that downstream projects like [`vcpkg`](https://github.com/microsoft/vcpkg) can build Arrow C++ on that platform. ### What changes are included in this PR? - The `windows` job from the `cpp.yml` workflow has been moved into a reusable workflow `cpp_windows.yml` - Use GitHub hosted runner `windows-11-arm` to build with MSVC ARM64 in `cpp_extra.yml` - `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) ### Are these changes tested? Yes, in the CI itself ### Are there any user-facing changes? No * GitHub Issue: #47196 Authored-by: Jonathan Giannuzzi <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 62afc09 commit 8dd9eba

File tree

6 files changed

+182
-111
lines changed

6 files changed

+182
-111
lines changed

.github/workflows/cpp.yml

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -280,100 +280,13 @@ jobs:
280280
ci/scripts/cpp_test.sh $(pwd) $(pwd)/build
281281
282282
windows:
283-
name: ${{ matrix.title }}
284-
runs-on: ${{ matrix.os }}
285283
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
286-
timeout-minutes: 60
287-
strategy:
288-
fail-fast: false
289-
matrix:
290-
os:
291-
- windows-2022
292-
include:
293-
- os: windows-2022
294-
simd-level: AVX2
295-
title: AMD64 Windows 2022 AVX2
296-
env:
297-
ARROW_BOOST_USE_SHARED: OFF
298-
ARROW_BUILD_BENCHMARKS: ON
299-
ARROW_BUILD_SHARED: ON
300-
ARROW_BUILD_STATIC: OFF
301-
ARROW_BUILD_TESTS: ON
302-
ARROW_DATASET: ON
303-
ARROW_FLIGHT: OFF
304-
ARROW_HDFS: ON
305-
ARROW_HOME: /usr
306-
ARROW_JEMALLOC: OFF
307-
ARROW_MIMALLOC: ON
308-
ARROW_ORC: ON
309-
ARROW_PARQUET: ON
310-
ARROW_SIMD_LEVEL: ${{ matrix.simd-level }}
311-
ARROW_SUBSTRAIT: ON
312-
ARROW_USE_GLOG: OFF
313-
ARROW_VERBOSE_THIRDPARTY_BUILD: OFF
314-
ARROW_WITH_BROTLI: OFF
315-
ARROW_WITH_BZ2: OFF
316-
ARROW_WITH_LZ4: OFF
317-
ARROW_WITH_OPENTELEMETRY: OFF
318-
ARROW_WITH_SNAPPY: ON
319-
ARROW_WITH_ZLIB: ON
320-
ARROW_WITH_ZSTD: ON
321-
BOOST_SOURCE: BUNDLED
322-
CMAKE_CXX_STANDARD: "17"
323-
CMAKE_GENERATOR: Ninja
324-
CMAKE_INSTALL_PREFIX: /usr
325-
CMAKE_UNITY_BUILD: ON
326-
steps:
327-
- name: Disable Crash Dialogs
328-
run: |
329-
reg add `
330-
"HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" `
331-
/v DontShowUI `
332-
/t REG_DWORD `
333-
/d 1 `
334-
/f
335-
- name: Checkout Arrow
336-
uses: actions/checkout@v5
337-
with:
338-
fetch-depth: 0
339-
submodules: recursive
340-
- name: Download Timezone Database
341-
shell: bash
342-
run: ci/scripts/download_tz_database.sh
343-
- name: Install ccache
344-
shell: bash
345-
run: |
346-
ci/scripts/install_ccache.sh 4.6.3 /usr
347-
- name: Setup ccache
348-
shell: bash
349-
run: |
350-
ci/scripts/ccache_setup.sh
351-
- name: ccache info
352-
id: ccache-info
353-
shell: bash
354-
run: |
355-
echo "cache-dir=$(ccache --get-config cache_dir)" >> $GITHUB_OUTPUT
356-
- name: Cache ccache
357-
uses: actions/cache@v4
358-
with:
359-
path: ${{ steps.ccache-info.outputs.cache-dir }}
360-
key: cpp-ccache-windows-${{ env.CACHE_VERSION }}-${{ hashFiles('cpp/**') }}
361-
restore-keys: cpp-ccache-windows-${{ env.CACHE_VERSION }}-
362-
env:
363-
# We can invalidate the current cache by updating this.
364-
CACHE_VERSION: "2022-09-13"
365-
- name: Build
366-
shell: cmd
367-
run: |
368-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
369-
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
370-
- name: Test
371-
shell: cmd
372-
run: |
373-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
374-
# For ORC
375-
set TZDIR=C:\msys64\usr\share\zoneinfo
376-
bash -c "ci/scripts/cpp_test.sh $(pwd) $(pwd)/build"
284+
name: AMD64 Windows 2022 AVX2 C++
285+
uses: ./.github/workflows/cpp_windows.yml
286+
with:
287+
arch: x64
288+
os: windows-2022
289+
simd-level: AVX2
377290

378291
windows-mingw:
379292
name: AMD64 Windows MinGW ${{ matrix.msystem_upper }} C++

.github/workflows/cpp_extra.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ jobs:
164164
continue-on-error: true
165165
run: archery docker push ${{ matrix.image }}
166166

167+
msvc-arm64:
168+
needs: check-labels
169+
if: >-
170+
needs.check-labels.outputs.force == 'true' ||
171+
contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra') ||
172+
contains(fromJSON(needs.check-labels.outputs.ci-extra-labels || '[]'), 'CI: Extra: C++')
173+
name: ARM64 Windows 11 MSVC
174+
uses: ./.github/workflows/cpp_windows.yml
175+
with:
176+
arch: arm64
177+
os: windows-11-arm
178+
simd-level: NONE
179+
167180
jni-linux:
168181
needs: check-labels
169182
name: JNI ${{ matrix.platform.runs-on }} ${{ matrix.platform.arch }}

.github/workflows/cpp_windows.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: C++ Windows MSVC Reusable
19+
20+
on:
21+
workflow_call:
22+
inputs:
23+
arch:
24+
description: "The architecture to build for"
25+
required: true
26+
type: string
27+
os:
28+
description: "The runner label to run the job on"
29+
required: true
30+
type: string
31+
simd-level:
32+
description: "The Arrow SIMD level to build with"
33+
required: true
34+
type: string
35+
36+
jobs:
37+
windows:
38+
runs-on: ${{ inputs.os }}
39+
timeout-minutes: 60
40+
env:
41+
ARROW_BOOST_USE_SHARED: OFF
42+
ARROW_BUILD_BENCHMARKS: ON
43+
ARROW_BUILD_SHARED: ON
44+
ARROW_BUILD_STATIC: OFF
45+
ARROW_BUILD_TESTS: ON
46+
ARROW_DATASET: ON
47+
ARROW_FLIGHT: OFF
48+
ARROW_HDFS: ON
49+
ARROW_HOME: /usr
50+
ARROW_JEMALLOC: OFF
51+
ARROW_MIMALLOC: ON
52+
ARROW_ORC: ON
53+
ARROW_PARQUET: ON
54+
ARROW_SIMD_LEVEL: ${{ inputs.simd-level }}
55+
ARROW_SUBSTRAIT: ON
56+
ARROW_USE_GLOG: OFF
57+
ARROW_VERBOSE_THIRDPARTY_BUILD: OFF
58+
ARROW_WITH_BROTLI: OFF
59+
ARROW_WITH_BZ2: OFF
60+
ARROW_WITH_LZ4: OFF
61+
ARROW_WITH_OPENTELEMETRY: OFF
62+
ARROW_WITH_SNAPPY: ON
63+
ARROW_WITH_ZLIB: ON
64+
ARROW_WITH_ZSTD: ON
65+
BOOST_SOURCE: BUNDLED
66+
CMAKE_CXX_STANDARD: "17"
67+
CMAKE_GENERATOR: Ninja
68+
CMAKE_INSTALL_PREFIX: /usr
69+
CMAKE_UNITY_BUILD: ON
70+
steps:
71+
- name: Disable Crash Dialogs
72+
run: |
73+
reg add `
74+
"HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" `
75+
/v DontShowUI `
76+
/t REG_DWORD `
77+
/d 1 `
78+
/f
79+
- name: Checkout Arrow
80+
uses: actions/checkout@v5
81+
with:
82+
fetch-depth: 0
83+
submodules: recursive
84+
- name: Download Timezone Database
85+
shell: bash
86+
run: ci/scripts/download_tz_database.sh
87+
- name: Install msys2 (for tzdata for ORC tests)
88+
uses: msys2/setup-msys2@v2
89+
id: setup-msys2
90+
- name: Install cmake
91+
shell: bash
92+
run: |
93+
ci/scripts/install_cmake.sh 4.1.2 /usr
94+
- name: Install ccache
95+
shell: bash
96+
run: |
97+
ci/scripts/install_ccache.sh 4.12.1 /usr
98+
- name: Setup ccache
99+
shell: bash
100+
run: |
101+
ci/scripts/ccache_setup.sh
102+
- name: ccache info
103+
id: ccache-info
104+
shell: bash
105+
run: |
106+
echo "cache-dir=$(ccache --get-config cache_dir)" >> $GITHUB_OUTPUT
107+
- name: Cache ccache
108+
uses: actions/cache@v4
109+
with:
110+
path: ${{ steps.ccache-info.outputs.cache-dir }}
111+
key: cpp-ccache-windows-${{ inputs.arch }}-${{ hashFiles('cpp/**') }}
112+
restore-keys: cpp-ccache-windows-${{ inputs.arch }}-
113+
- name: Build
114+
shell: cmd
115+
run: |
116+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.arch }}
117+
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
118+
- name: Test
119+
shell: cmd
120+
run: |
121+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.arch }}
122+
# For ORC
123+
set TZDIR=${{ steps.setup-msys2.outputs.msys2-location }}\usr\share\zoneinfo
124+
bash -c "ci/scripts/cpp_test.sh $(pwd) $(pwd)/build"

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+
if [ "${platform}" = "macos" ]; then
84+
ln -s CMake.app/Contents/bin "${prefix}/bin"
85+
fi
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)