Skip to content

Commit e4b9819

Browse files
committed
Merge pull request #7002 from ahorek/winarm64
support cross-compiling for windows_arm64
1 parent 5511380 commit e4b9819

8 files changed

Lines changed: 54 additions & 16 deletions

File tree

.github/workflows/mingw.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ env:
3535

3636
jobs:
3737
build:
38-
name: ${{ matrix.type }}-build
38+
name: ${{ matrix.type }}-${{ matrix.arch }}-build
3939
runs-on: ubuntu-latest
4040
strategy:
4141
matrix:
42+
arch: [x86_64, aarch64]
4243
type: [libs-mingw, apps-mingw-vcpkg, libs-mingw-cmake]
44+
exclude:
45+
- arch: aarch64
46+
type: apps-mingw-vcpkg
47+
- arch: aarch64
48+
type: libs-mingw-cmake
4349
fail-fast: false
4450
steps:
4551
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
@@ -57,11 +63,29 @@ jobs:
5763
- name: Install dependencies
5864
run: |
5965
sudo apt-get update
60-
sudo apt-get install -y mingw-w64 mingw-w64-tools mingw-w64-x86-64-dev mingw-w64-i686-dev tar curl zip unzip p7zip-full
66+
sudo apt-get install -y tar curl zip unzip p7zip-full
6167
62-
- name: Make libs with mingw
63-
if: success() && matrix.type == 'libs-mingw'
68+
- name: Install x86_64 mingw toolchain
69+
if: success() && matrix.arch == 'x86_64'
70+
run: |
71+
sudo apt-get install -y mingw-w64 mingw-w64-tools mingw-w64-x86-64-dev mingw-w64-i686-dev
72+
73+
- name: Install aarch64 llvm-mingw toolchain
74+
if: success() && matrix.arch == 'aarch64'
75+
run: |
76+
wget -q https://github.com/mstorsjo/llvm-mingw/releases/download/20260421/llvm-mingw-20260421-msvcrt-ubuntu-22.04-x86_64.tar.xz
77+
echo "18488138efd8d621930fa85c86c3e3eb9967c0bfa253e1f6f73c5212f7180f31 llvm-mingw-20260421-msvcrt-ubuntu-22.04-x86_64.tar.xz" | sha256sum -c -
78+
tar -Jxf llvm-mingw-20260421-msvcrt-ubuntu-22.04-x86_64.tar.xz
79+
echo "$GITHUB_WORKSPACE/llvm-mingw-20260421-msvcrt-ubuntu-22.04-x86_64/bin" >> $GITHUB_PATH
80+
81+
- name: Build libs (x86_64)
82+
if: matrix.type == 'libs-mingw' && matrix.arch == 'x86_64'
6483
run: cd lib && MINGW=x86_64-w64-mingw32 make -f Makefile.mingw
84+
85+
- name: Build libs (aarch64)
86+
if: success() && matrix.type == 'libs-mingw' && matrix.arch == 'aarch64'
87+
run: cd lib && MINGW=aarch64-w64-mingw32 make -f Makefile.mingw
88+
6589
- name: Install Powershell for vcpkg
6690
if: success() && matrix.type == 'apps-mingw-vcpkg'
6791
run: |
@@ -101,7 +125,7 @@ jobs:
101125
if: ${{ failure() }}
102126
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
103127
with:
104-
name: mingw_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
128+
name: mingw_logs_${{ matrix.type }}_${{ matrix.arch }}_${{ github.event.pull_request.head.sha }}
105129
path: deploy/logs.7z
106130

107131
- name: Prepare artifacts for deploy
@@ -112,5 +136,5 @@ jobs:
112136
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
113137
if: ${{! contains(matrix.type, 'libs')}}
114138
with:
115-
name: win_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
139+
name: win_${{ matrix.type }}_${{ matrix.arch }}_${{ github.event.pull_request.head.sha }}
116140
path: deploy/win_${{ matrix.type }}.7z

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ AM_CONDITIONAL(OS_LINUX, [echo $host_os | grep '^linux' > /dev/null])
12151215
AM_CONDITIONAL(OS_FREEBSD, [echo $host_os | grep '^freebsd' > /dev/null])
12161216
dnl In case anyone wants to try building the windows code using mingw!
12171217
AM_CONDITIONAL(OS_WIN32, [echo $host_os | grep -E '^mingw|^winnt' > /dev/null])
1218+
AM_CONDITIONAL(OS_WINARM64, [echo $host_os | grep -E '^mingw|^winnt' > /dev/null && echo $host_cpu | grep -E '^aarch64' > /dev/null])
12181219
AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
12191220
dnl or OS2
12201221
AM_CONDITIONAL(OS_OS2, [echo $host_os | grep '^os2' > /dev/null])

lib/Makefile.am

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ win_sources = \
8080
idlemon_win.cpp \
8181
procinfo_win.cpp \
8282
run_app_windows.cpp \
83-
stackwalker_win.cpp \
8483
win_util.cpp \
8584
wslinfo.cpp
86-
win_headers= \
85+
if !OS_WINARM64
86+
win_sources += \
87+
stackwalker_win.cpp
88+
endif
89+
win_headers = \
8790
boinc_win.h \
8891
diagnostics_win.h \
8992
run_app_windows.h \

lib/Makefile.mingw

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ ifdef MINGW
3232
RANLIB = $(MINGW)-ranlib
3333
endif
3434

35+
ifeq ($(findstring aarch64,$(shell $(CXX) -dumpmachine)),aarch64)
36+
AARCH64_BUILD = 1
37+
endif
38+
3539
# headers to install
3640
HEADERS = $(BOINC_SRC)/version.h \
3741
$(BOINC_SRC)/svn_version.h \
@@ -96,12 +100,15 @@ LIB_OBJ = app_ipc.o \
96100
proxy_info.o \
97101
str_util.o \
98102
shmem.o \
99-
stackwalker_win.o \
100103
url.o \
101104
util.o \
102105
win_util.o \
103106
wslinfo.o
104107

108+
ifndef AARCH64_BUILD
109+
LIB_OBJ += stackwalker_win.o
110+
endif
111+
105112
ZIP_OBJ = zip/boinc_zip.o
106113

107114
# libraries to build
@@ -130,9 +137,9 @@ OPTFLAGS = -O3
130137
# various cpp & gcc flags (for both C and C++ mode)
131138
# set NOCYGWIN=-mno-cygwin to build non-Cygwin Windows libs under Cygwin
132139
# -D_WIN32_WINDOWS=0x0410 sets to use Win98 API
133-
WINVERFLAGS = -D_WINDOWS -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_MT
134140
HAVEFLAGS = -DHAVE_STRCASECMP
135-
CCXXFLAGS = $(INCS) $(DEBUG) --include $(BOINC_SRC)/version.h -DEINSTEINATHOME_CROSS_BUILD -DMINGW_WIN32 \
141+
WINVERFLAGS = -D_WINDOWS -D_MT -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500
142+
CCXXFLAGS = $(INCS) $(DEBUG) --include $(BOINC_SRC)/version.h \
136143
$(HAVEFLAGS) $(WINVERFLAGS) -DBOINC \
137144
-DNODB -D_CONSOLE -fexceptions $(OPTFLAGS) $(NOCYGWIN)
138145

lib/boinc_win.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
#endif
162162

163163
#ifndef HAVE_SOCKLEN_T
164+
#include <stddef.h> // for size_t
164165
typedef size_t socklen_t;
165166
#endif
166167

lib/diagnostics.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ int diagnostics_init(
386386
//_set_abort_behavior(NULL, _WRITE_ABORT_MSG);
387387
#ifdef __MINGW32__
388388
std::set_terminate(boinc_term_func);
389-
std::set_unexpected(boinc_term_func);
389+
#ifndef __aarch64__
390+
std::set_unexpected(boinc_term_func);
391+
#endif
390392
#else
391393
set_terminate(boinc_term_func);
392394
set_unexpected(boinc_term_func);

lib/diagnostics_win.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID /* lpParameter */) {
16141614
// Dump some basic stuff about runtime debugger version and date
16151615
diagnostics_unhandled_exception_dump_banner();
16161616

1617-
#if !defined(__CYGWIN__) && !defined(_M_ARM) && !defined(_M_ARM64)
1617+
#if !defined(__CYGWIN__) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__aarch64__)
16181618
// Kickstart the debugger extensions, look for the debugger files
16191619
// in the install directory if it is defined, otherwise look
16201620
// in the data directory.
@@ -1655,7 +1655,7 @@ UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID /* lpParameter */) {
16551655
}
16561656

16571657
if (diagnostics_is_flag_set(BOINC_DIAG_DUMPCALLSTACKENABLED)) {
1658-
#if !defined(__CYGWIN__) && !defined(_M_ARM) && !defined(_M_ARM64)
1658+
#if !defined(__CYGWIN__) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__aarch64__)
16591659
if (bDebuggerInitialized) {
16601660
if (pThreadEntry->crash_exception_record ) {
16611661
StackwalkFilter(
@@ -1679,7 +1679,7 @@ UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID /* lpParameter */) {
16791679
}
16801680
}
16811681
#else
1682-
fprintf(stderr, "Warning: Callstack dumps are not supported on CYGWIN\n");
1682+
fprintf(stderr, "Warning: Callstack dumps are not supported\n");
16831683
#endif
16841684
}
16851685
fprintf(stderr, "\n");

mingw/ci_make_apps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export CC="x86_64-w64-mingw32-gcc"
3535
export MINGW_FLAGS="-Dflockfile=_lock_file -Dfunlockfile=_unlock_file"
3636
export CURL_EXTRA_LDFLAGS="-lcurl -lwinmm -lpthread -lssl -lcrypto -lws2_32 -lzlib -ladvapi32 -lcrypt32 -lbcrypt"
3737
# wrapper
38-
export MINGW_WRAPPER_FLAGS="-DEINSTEINATHOME_CROSS_BUILD -DMINGW_WIN32 -DHAVE_STRCASECMP -D_WINDOWS -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_MT -DBOINC -DNODB -D_CONSOLE -fexceptions"
38+
export MINGW_WRAPPER_FLAGS="-DHAVE_STRCASECMP -D_WINDOWS -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_MT -DBOINC -DNODB -D_CONSOLE -fexceptions"
3939
export MINGW_LIBS="-lpsapi -lzip"
4040
# wrappture
4141
if [ ! -f $VCPKG_DIR/lib/libz.a ]; then

0 commit comments

Comments
 (0)