> The first project I was able to change their workflow to build inside a 20.04 container.
This approach does _not_ work because you end up with the `node` that runs GitHub Actions not being able to run, certainly this will happen if you end using a sufficiently old container.
> Do you have any documentation or generic recommendations for solving these issues caused by blindly using GitHub Actions for all compilations?
Install these pkgs in an `ubuntu-latest` image:
- debootstrap debian-archive-keyring
- software-properties-common
- schroot fakeroot fakechroot
then - name: 'Cache sysroot'
# This comes after checking out the sources because
# actions/checkout@v4 cleans $PWD!
id: cache-sysroot
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/sysroot-DEBIAN_RELEASE
key: sysroot-DEBIAN_RELEASE-${{ runner.os }}-${{ runner.arch }}-v1
- name: 'Setup cross-compilation sysroot'
if: steps.cache-sysroot.oututs.cache-hit != 'true'
run: |
set -vx
SYSROOT_PATH="${{ github.workspace }}/sysroot-DEBIAN_RELEASE"
echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV
if [ ! -d sysroot-DEBIAN_RELEASE ]; then
sudo debootstrap --arch=$(dpkg --print-architecture) DEBIAN_RELEASE sysroot-DEBIAN_RELEASE http://archive.ubuntu.com/ubuntu
fi
sudo chroot sysroot-DEBIAN_RELEASE apt-get update
sudo chroot sysroot-DEBIAN_RELEASE apt-get install -y build-essential git wget curl sudo unzip zip autoconf libfreetype6-dev libcups2-dev libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev libasound2-dev libffi-dev file binutils libfontconfig-dev
sudo chroot sysroot-DEBIAN_RELEASE apt-get install -y software-properties-common
sudo chroot sysroot-DEBIAN_RELEASE sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo chown -R $USER:$USER sysroot-DEBIAN_RELEASE
where you replace `DEBIAN_RELEASE` with the release you want to target, and then - configure your project's build to use that sysroot.
That's it.If your project does not support sysroots, make it do so. In general compilers will support sysroots, so it's just a matter of making your build configuration facility support sysroots.