Skip to content
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

Build macOS arm64 variants #2618

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ jobs:
strategy:
fail-fast: false
matrix:
name: [macos-12-clang, macos-13-clang]
arch: [x86_64, arm64]
os: [macos-12, macos-13]
include:
- name: macos-12-clang
os: macos-12
- os: macos-12
compiler: clang
- name: macos-13-clang
os: macos-13
- os: macos-13
compiler: clang
- arch: x86_64
suffix: amd64
- arch: arm64
suffix: arm64

steps:
- name: Clone repository
uses: actions/checkout@v3
Expand All @@ -30,18 +34,19 @@ jobs:
sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
- name: Build
env:
CC: ${{ matrix.compiler }}
CC: '${{ matrix.compiler }} -arch ${{ matrix.arch }}'
MAKEVARS: ${{ matrix.makevars }}
run: |
autoreconf -fi
rm src/lexer.c src/lexer.h
rm src/parser.c src/parser.h
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(brew --prefix)/opt/bison/bin/bison -y" $COVERAGE
./configure --disable-valgrind --with-oniguruma=builtin --target=${{ matrix.arch }}-apple-darwin$(uname -r) YACC="$(brew --prefix)/opt/bison/bin/bison -y" $COVERAGE
Copy link
Member

Choose a reason for hiding this comment

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

Fails on arm64 builds fails with:

If you meant to cross compile, use `--host'.

I tried this locally and this succeeded:

$ CC="clang -arch arm64" ./configure --disable-valgrind --with-oniguruma=builtin --host=arm64-apple-darwin$(uname -r) YACC="$(brew --prefix)/opt/bison/bin/bison -y" && make clean && make
...
$ file jq
jq: Mach-O 64-bit executable arm64

But i don't have much experience using clang+auto* to cross compile

make -j4
echo "$(file ./jq) built against target ${{ matrix.arch }}-apple-darwin$(uname -r)"
make dist
- name: Test
env:
CC: ${{ matrix.compiler }}
CC: '${{ matrix.compiler }} -arch ${{ matrix.arch }}'
MAKEVARS: ${{ matrix.makevars }}
run: |
ulimit -c unlimited
Expand All @@ -57,6 +62,7 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: jq-${{ matrix.name }}
# jq-macos-12-amd64, ..., jq-macos-13-arm64
name: jq-${{ matrix.os }}-${{ matrix.suffix }}
path: |
jq