Skip to content

Run the emulated tests on the cross packages' libraries - #47

Merged
srijs merged 1 commit into
mainfrom
ci-cross-libc-for-qemu
Nov 9, 2026
Merged

srijs merged 1 commit into
mainfrom
ci-cross-libc-for-qemu

Conversation

@srijs

@srijs srijs commented Nov 9, 2026

Copy link
Copy Markdown
Owner

ubuntu-latest moved to ubuntu-26.04, which installs Ubuntu's amd64v3 packages. Their glibc assumes AVX2, and the x86_64 emulated jobs ran the test binaries on the runner's own glibc, so under -cpu Nehalem and -cpu Denverton they died of SIGILL before a test started.

Each emulated job now installs its target's *-cross libc and libgcc, which are built for the baseline of their architecture, and points QEMU at them with -L. -L alone is not enough: QEMU only serves a path from the prefix when it exists there and quietly falls back to the host's otherwise, and the guest's loader reads the host's ld.so.cache, which names /usr/lib//libc.so.6. So -E LD_LIBRARY_PATH=/lib makes the loader look in /lib first, which -L maps into the sysroot. This also fixes the i686 and i586 jobs, whose -L /usr/i686-linux-gnu pointed at a directory nothing installed, so they had been on the host's multilib libc all along.

A new step runs the sysroot's loader with --list on a test binary, through the same QEMU flags as the tests, and fails if any library resolves outside the sysroot, so a fallback to the host cannot go unnoticed again.

ubuntu-latest moved to ubuntu-26.04, which installs Ubuntu's amd64v3
packages. Their glibc assumes AVX2, and the x86_64 emulated jobs ran the
test binaries on the runner's own glibc, so under `-cpu Nehalem` and
`-cpu Denverton` they died of SIGILL before a test started.

Each emulated job now installs its target's *-cross libc and libgcc,
which are built for the baseline of their architecture, and points QEMU
at them with `-L`. `-L` alone is not enough: QEMU only serves a path from
the prefix when it exists there and quietly falls back to the host's
otherwise, and the guest's loader reads the host's ld.so.cache, which
names /usr/lib/<triple>/libc.so.6. So `-E LD_LIBRARY_PATH=/lib` makes the
loader look in /lib first, which `-L` maps into the sysroot. This also
fixes the i686 and i586 jobs, whose `-L /usr/i686-linux-gnu` pointed at a
directory nothing installed, so they had been on the host's multilib libc
all along.

A new step runs the sysroot's loader with `--list` on a test binary,
through the same QEMU flags as the tests, and fails if any library
resolves outside the sysroot, so a fallback to the host cannot go
unnoticed again.
@srijs
srijs merged commit 5861e1d into main Nov 9, 2026
20 checks passed
@srijs
srijs deleted the ci-cross-libc-for-qemu branch November 9, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant