Skip to content

Commit

Permalink
fix: static linking to libgcc in nightlies
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Oct 11, 2024
1 parent 68d701c commit f04687b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,52 @@ jobs:
fail-fast: false # Attempt to generate as many of them as possible
matrix:
os:
- macos-14
- macos-12
- macos-14
- ubuntu-20.04
- windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Install FSF toolchain
uses: alire-project/alr-install@v1
with:
crates: gnat_native gprbuild
prefix: alire_prefix

- name: Replace toolchain with aarch64
if: ${{ runner.arch == 'ARM64' }}
- name: Display toolchain configuration and verify matching arch
shell: bash
run: |
curl -L https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-14.1.0-3/gnat-aarch64-darwin-14.1.0-3.tar.gz \
| tar xzf - --strip-components=1 -C /Users/runner/work/alire/alire/alire_prefix
curl -L https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-24.0.0-1/gprbuild-aarch64-darwin-24.0.0-1.tar.gz \
| tar xzf - --strip-components=1 -C /Users/runner/work/alire/alire/alire_prefix
which gcc
gcc -v
case ${{runner.arch}} in
X64) target_arch=x86_64;;
ARM64) target_arch=aarch64;;
*) echo "Unknown arch" && exit 1;;
esac
which gcc
gcc -v
gcc -dumpmachine && gcc -dumpmachine | grep -q $target_arch || exit 1
gprbuild --version && gprbuild --version | grep -q $target_arch || exit 1
- name: Install Python 3.x (required for the testsuite)
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Run test script
run: scripts/ci-github.sh
shell: bash

# Ascertain whether alr can run without the toolchain that built it
- name: Remove toolchain used for building & testing
shell: bash
run: |
rm -rf alire_prefix
which gnat || { echo "Toolchain purged"; ./bin/alr version; }
- name: Upload logs (if failed)
if: failure()
uses: actions/upload-artifact@v4
Expand Down
20 changes: 19 additions & 1 deletion scripts/ci-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ fi
# Patch version
scripts/version-patcher.sh

# use -static-libgcc only in recent-enough GCC versions (>=12). The version is
# the last space-separated field of the first line in gcc --version output.
# Also, this is only needed on macOS for now.
ALR_LINKER_ARGS=
if [ "$(get_OS)" == "macos" ]; then
gcc_version=$(gcc --version | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | tail -n1 | cut -f1 -d.)
if [ "$(echo "$gcc_version >= 12" | bc)" -eq 1 ]; then
ALR_LINKER_ARGS="-static-libgcc"
fi
fi

# Build alr if no argument is "build=false"
if [[ " $* " == *" build=false "* ]]; then
echo "Skipping alr build, explicitly disabled via arguments"
else
export ALIRE_OS=$(get_OS)
gprbuild -j0 -p -P alr_env
echo "Using ALR_LINKER_ARGS=$ALR_LINKER_ARGS"
gprbuild -j0 -p -P alr_env -largs $ALR_LINKER_ARGS
fi

# Disable distro detection if supported
Expand Down Expand Up @@ -70,6 +82,12 @@ echo ALR SEARCH:
alr -q -d search --list --external
echo ............................

# Exit without testing if some argument is "test=false"
if [[ " $* " == *" test=false "* ]]; then
echo "SKIPPING testsuite, explicitly disabled via arguments"
exit 0
fi

echo TESTSUITE:
# Run e3.testsuite
echo
Expand Down

0 comments on commit f04687b

Please sign in to comment.