3 ms·
This happens in CIs. It's happened to me on GitHub Actions. The answer is always sysroots.
by cryptonector 1y ago
This happens in CIs. It's happened to me on GitHub Actions. The answer is always sysroots.
- Arrowmaster 1y agoI'm in the middle of submitting PRs to multiple projects because they are compiling on ubuntu-latest and forcing a glibc 2.38 requirement. These are multiplatform projects where most or none of the devs use Linux. The first project I was able to change their workflow to build inside a 20.04 container. The other project uses tauri and it requires some very recent libraries so I don't know if an older container will work. Do you have any documentation or generic recommendations for solving these issues caused by blindly using GitHub Actions for all compilations?
- cryptonector 1y ago> 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.