-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for macOS/arm64 #275
Comments
Hi @BatchDrake, ARM64 is already supported on macOS - I have a few projects that produce ARM64 builds using To expand, as I understand it, For CMake-based projects, to build for macOS ARM64, simply install Qt via the this action, then set Here's a sample step I use for macOS builds in one of my FLOSS projects, just to give you a sense of what's possible: - name: Choose target architectures
id: arch
run: |
# Qt only supports x86-64 (not arm64) prior to Qt 6.2.0. See https://www.qt.io/blog/qt-on-apple-silicon
if [[ '${{ matrix.qt }}' =~ ^(5|6\.[01])\. ]]; then arch=x86_64
# GitHub runners' (homebrew'd) gcc's only support support x86-64 prior to macos-14, and only arm64 after.
# Note: if we attempt to use multiple archs, gcc will warn, but continue, resulting in later failures.
elif [[ '${{ matrix.cc }}' == 'gcc' ]]; then
if [[ '${{ matrix.os }}' == 'macos-13' ]]; then arch='x86_64'; else arch='arm64'; fi
# Otherwise, default to universal binaries, where possible.
else arch='arm64;x86_64'; fi
tee -a "$GITHUB_ENV" <<< "CMAKE_OSX_ARCHITECTURES=${arch}"
tee -a "$GITHUB_OUTPUT" <<< "buildId=${arch//;/-}"
I hope that helps ☺ Cheers. |
Thanks for your help, @pcolby.
Right.
Maybe the installation config in your YAML is also important: - name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
documentation: true
doc-archives: >-
${{ (startsWith(matrix.qt, '5.10.') || startsWith(matrix.qt, '5.11.')) && 'qt' ||
(startsWith(matrix.qt, '5') && 'qtcore qtbluetooth' || 'qtcore') }}
doc-modules: ${{ startsWith(matrix.qt, '6') && 'qtbluetooth' || '' }}
aqtversion: '>=3.2.0' # 3.2.0+ required for Qt 6.8+ support; https://github.com/miurahr/aqtinstall/issues/843
# from: https://github.com/pcolby/dokit/blob/617499c13132db613dafb8c187069e107354ad87/.github/workflows/build.yaml#L254-L264
And it would be better to use permalinks:
To @BatchDrake and @pcolby: The "install-qt-action" action prints arguments of each "aqtinstall" call during its running, so you can debug it by directly using "aqtinstall" yourself and report new bugs in their repository: https://github.com/miurahr/aqtinstall |
Thanks @pzhlkj6612, that's a great tip I will use from now on! 😊 |
Hi, and thanks for your helpful answers! Now everything builds as expected. In the end it was a GitHub runner issue, Homebrew either fails to install x86-64 libraries or they get installed somewhere else and the library paths are wrong. Either way I am sure it can be fixed one way or another. A workaround that may work for some could be to link against arm64 alone, this is what I am currently doing until I figure this out. |
@BatchDrake, good to hear that! And I think you can report the bug in GitHub's repository: https://github.com/actions/runner-images |
The newest macOS runners in GitHub are arm64 only. While other libraries and brew dependencies install themselves for arm64, this action keeps installing the x86_64 version in macOS. Are there plans for adding this arm64 support soon?
The text was updated successfully, but these errors were encountered: