Skip to content

support cross-compiling for windows_arm64#7002

Merged
AenBleidd merged 1 commit intoBOINC:masterfrom
ahorek:winarm64
Apr 26, 2026
Merged

support cross-compiling for windows_arm64#7002
AenBleidd merged 1 commit intoBOINC:masterfrom
ahorek:winarm64

Conversation

@ahorek
Copy link
Copy Markdown
Contributor

@ahorek ahorek commented Apr 15, 2026

Description of the Change
fixes a few issues to allow cross-compiling libraries for --host=aarch64-w64-mingw32 --with-boinc-platform="windows_arm64"

https://github.com/mstorsjo/llvm-mingw/releases

Alternate Designs
Visual Studio works well, but many existing projects rely on GCC / Clang, and porting them to Visual Studio isn’t always straightforward.

Release Notes
N/A


Summary by cubic

Enable cross-compiling BOINC libraries for Windows ARM64 with MinGW/Clang (--host=aarch64-w64-mingw32, --with-boinc-platform=windows_arm64). CI builds x86_64 and ARM64 libs on Ubuntu using mingw-w64/llvm-mingw, verifies the llvm-mingw checksum, and tags artifacts/logs by arch.

  • New Features

    • Add OS_WINARM64 and detect AARCH64_BUILD in lib/Makefile.mingw.
    • Exclude stackwalker_win.cpp on ARM64 (Autotools and Makefile guards).
    • Keep WINVER/_WIN32_WINNT defines; drop legacy cross-build defines.
    • Guard std::set_unexpected and callstack dumps on __aarch64__.
    • Include <stddef.h> for socklen_t.
  • CI

    • Matrix by arch (x86_64, aarch64) with per-arch toolchains (mingw-w64, llvm-mingw).
    • Download llvm-mingw 20260421, verify SHA-256, add to PATH for ARM64.
    • Separate build steps for libs by arch; skip apps-mingw-vcpkg and libs-mingw-cmake on ARM64.
    • Name jobs, artifacts, and logs with arch.

Written for commit 91ccb8d. Summary will update on new commits.

@AenBleidd
Copy link
Copy Markdown
Member

Please add a CI test for this here: https://github.com/BOINC/boinc/blob/master/.github/workflows/mingw.yml

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/Makefile.mingw">

<violation number="1" location="lib/Makefile.mingw:104">
P2: `OS_WINARM64` is gated in `Makefile.mingw` but not defined for this build path, so `stackwalker_win.o` may still be built on win_arm64.</violation>
</file>

<file name="lib/Makefile.am">

<violation number="1" location="lib/Makefile.am:86">
P1: `win_sources +=` is missing a continuation backslash, causing `stackwalker_win.cpp` to be parsed as an invalid standalone makefile line.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread lib/Makefile.am Outdated
Comment thread lib/Makefile.mingw Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enable cross-compiling BOINC libraries for Windows ARM64 (e.g., --host=aarch64-w64-mingw32, --with-boinc-platform=windows_arm64) by gating x86-only stack-walking/debugger-extension code paths and fixing a Windows header typedef dependency.

Changes:

  • Add an Autoconf conditional (OS_WINARM64) intended to identify Windows ARM64 builds and use it to exclude x86-only stack-walking sources.
  • Disable/circumvent callstack dump initialization on ARM64/aarch64 in diagnostics_win.cpp.
  • Include <stddef.h> for size_t when defining socklen_t on Windows.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/diagnostics_win.cpp Avoids initializing/using stack-walking/debugger extensions on aarch64 targets and adjusts the unsupported warning.
lib/boinc_win.h Adds <stddef.h> so size_t is available when defining socklen_t.
lib/Makefile.mingw Excludes stackwalker_win.o when building for Windows ARM64 via a make-time flag.
lib/Makefile.am Attempts to exclude stackwalker_win.cpp from Windows builds on ARM64 via Automake conditionals.
configure.ac Introduces the OS_WINARM64 conditional to drive ARM64-specific build gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/Makefile.am Outdated
Comment thread configure.ac Outdated
@AenBleidd AenBleidd marked this pull request as draft April 15, 2026 19:22
Comment thread .github/workflows/mingw-aarch64.yml Outdated
Comment thread lib/Makefile.mingw.aarch64 Outdated
@github-project-automation github-project-automation Bot moved this from In progress to Review in progress in Client/Manager Apr 21, 2026
@ahorek ahorek changed the title Draft: support cross-compiling for windows_arm64 support cross-compiling for windows_arm64 Apr 26, 2026
@ahorek ahorek marked this pull request as ready for review April 26, 2026 15:03
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/mingw.yml">

<violation number="1" location=".github/workflows/mingw.yml:77">
P1: Unverified external llvm-mingw toolchain download is extracted and added to PATH without checksum/signature validation, creating a CI supply-chain risk.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .github/workflows/mingw.yml Outdated
@ahorek ahorek requested a review from AenBleidd April 26, 2026 15:59
run: |
sudo apt-get install -y mingw-w64 mingw-w64-tools mingw-w64-x86-64-dev mingw-w64-i686-dev

- name: Install aarch64 llvm-mingw toolchain
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any system package that provides the same executables? I prefer to not stich to a particular version, expecially from the GitHub repo that doesn't look like something more or less official (neither gcc not clang).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand, but unfortunately, there’s no system package like mingw-w64-aarch64-dev available. This toolchain is recommended on the official website https://www.mingw-w64.org/downloads/ (LLVM-MinGW)

Comment thread .github/workflows/mingw.yml Outdated
Comment thread lib/Makefile.mingw Outdated
Comment thread lib/Makefile.mingw Outdated
Comment thread lib/Makefile.mingw Outdated
Comment thread lib/diagnostics.cpp
std::set_terminate(boinc_term_func);
std::set_unexpected(boinc_term_func);
#ifndef __aarch64__
std::set_unexpected(boinc_term_func);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been deprecated since c++11 https://runebook.dev/en/docs/cpp/error/set_unexpected

It might be worth revisiting.

@AenBleidd AenBleidd merged commit 1a797f8 into BOINC:master Apr 26, 2026
487 of 490 checks passed
@github-project-automation github-project-automation Bot moved this from Review in progress to Merged in Client/Manager Apr 26, 2026
@AenBleidd
Copy link
Copy Markdown
Member

Looks fine to me.
@ahorek, thank you for your contribution!

AenBleidd added a commit that referenced this pull request Apr 30, 2026
support cross-compiling for windows_arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

3 participants