From b9eac35c00f5116078be4f144fac386112c1d13b Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 27 Oct 2021 20:02:41 +0100 Subject: [PATCH] Fix build system errors (#878) * Attempt cross compiling for apple silicon * Try the apple expected compiler * Make config.log viewable to figure out the compiler error * Attempt to install the missing architecture * Leave this branch in a working and documented what is missing state * Try cross-compiling on macos with a specific SDK version * Every now and again the runner pacakge db gets out of sync with reality - avoid this ever stopping a build, at the expense of making the builds take longer to run * Add needed macos cross compile linker flag * Fix package db sync for binaries build as well * Add a fat binary build * Add missing dep on the new binaries_macos_universal build * Copy the macos cross compile artifacts into the right shared binaries bucket * Use the correct arch-based subdir name for macos binaries --- .github/workflows/tests.yml | 61 +++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3148ab0..2c859d1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -253,6 +253,7 @@ jobs: - name: Install packages needed for build run: | + sudo apt-get update sudo apt-get install debhelper build-essential \ crossbuild-essential-${{ matrix.arch }} @@ -345,7 +346,56 @@ jobs: path: binaries binaries_macos: - name: Binaries for MacOS (x86_64-apple-darwin) + name: Binaries for MacOS + needs: + - test_macos + runs-on: macos-latest + strategy: + fail-fast: true + matrix: + arch: + - x86_64-apple-macos + - arm64-apple-macos + + steps: + - uses: actions/checkout@v2 + + - name: Install packages needed for build + run: | + brew install automake + + - name: Configure and Build + shell: bash + run: | + # this is a hack! it assumes the default SDK is the 'right' one + export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk + ./autogen.sh + export CC=clang + export CFLAGS="-target ${{ matrix.arch }}" + export LDFLAGS="-target ${{ matrix.arch }}" + ./configure --host=${{ matrix.arch }} + make + + - if: ${{ failure() }} + name: Upload config.log output + uses: actions/upload-artifact@v2 + with: + name: config-log-${{ matrix.arch }} + path: config.log + + - name: Create binary dir + shell: bash + run: | + make install DESTDIR=binaries/${{ matrix.arch }} + + - name: Upload binary artifacts + uses: actions/upload-artifact@v2 + with: + name: binaries + path: binaries + + binaries_macos_universal: + name: Binaries for MacOS (universal arch) needs: - test_macos runs-on: macos-latest @@ -360,14 +410,19 @@ jobs: - name: Configure and Build shell: bash run: | + # this is a hack! it assumes the default SDK is the 'right' one + export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ./autogen.sh + export CC=clang + export CFLAGS="-arch x86_64 -arch arm64" + export LDFLAGS="-arch x86_64 -arch arm64" ./configure make - name: Create binary dir shell: bash run: | - make install DESTDIR=binaries/x86_64-apple-darwin + make install DESTDIR=binaries/universal-apple-darwin - name: Upload binary artifacts uses: actions/upload-artifact@v2 @@ -399,6 +454,7 @@ jobs: - name: Install cross compiler run: | + sudo apt-get update sudo apt-get install \ binutils-${{ matrix.arch }} \ gcc-${{ matrix.arch }} @@ -431,6 +487,7 @@ jobs: - package_rpm - binaries_windows - binaries_macos + - binaries_macos_universal - binaries_linux_crosscompile runs-on: ubuntu-latest