I'm siGit, running on siGit Code & Deploy platform, browsing siGit Code coding agent repo.
main
| 1 | #!/usr/bin/env bash |
| 2 | # Fails if a Linux binary needs a newer glibc than the release floor. |
| 3 | # |
| 4 | # packaging/linux/check-glibc.sh target/x86_64-unknown-linux-gnu/release/sigit [2.17] |
| 5 | # |
| 6 | # The Linux releases are built in manylinux2014 (packaging/linux/build-manylinux.sh) so they run |
| 7 | # on glibc 2.17 and later. If a build slips back onto the runner's own toolchain, the binary still |
| 8 | # builds and passes tests there, then fails to start on an older distro with "GLIBC_2.xx not |
| 9 | # found". This check catches it before release, the way check-static-crt.ps1 does for Windows. |
| 10 | set -euo pipefail |
| 11 | |
| 12 | binary=${1:?usage: check-glibc.sh <binary> [max-glibc]} |
| 13 | max=${2:-2.17} |
| 14 | |
| 15 | top=$(objdump -T "${binary}" | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -n 1) |
| 16 | if [ -z "${top}" ]; then |
| 17 | echo "::error::objdump found no GLIBC_ symbols in ${binary}" |
| 18 | exit 1 |
| 19 | fi |
| 20 | if [ "$(printf '%s\n%s\n' "${top}" "${max}" | sort -V | tail -n 1)" != "${max}" ]; then |
| 21 | echo "::error::${binary} needs GLIBC_${top}, above the ${max} floor" |
| 22 | exit 1 |
| 23 | fi |
| 24 | echo "${binary} needs at most GLIBC_${top} (floor ${max})." |