archlinux-s390x/patches/pkgbuild
Mathieu Benoit 22b101dc47 [FIX] gcc: two defects only a chroot could find
Our gcc package was built a dozen times and never once used to compile
anything -- stage 1 compiles with Ubuntu's gcc. The first program it was ever
asked to link was in the stage-2 chroot, and it failed twice.

  collect2: fatal error: cannot find 'ld'

/usr/bin/ld was present, executable, on PATH, and ran as the same user. -B,
COMPILER_PATH and three symlinks changed nothing. strace settled it in one
line: it was looking for s390x-linux-gnu-ld, the DEBIAN triplet, and printing
the generic name. gcc's configure had recorded Ubuntu's copy, a file no Arch
system will ever have. --with-ld and --with-as now pin absolute paths, correct
on the host, in the chroot and on the target alike.

  /usr/bin/ld: cannot find -lgcc_s

package_gcc() moves libgcc_s{,_asneeded}.so three directories deeper. The
asneeded one is a linker script and survives; libgcc_s.so is a symlink naming
its target relative to /usr/lib, so after the move it points at nothing. The
only libgcc_s.so on the system was dangling, so -lgcc_s could not resolve and
nothing linked at all -- not even int main(void){return 0;}.

Verified: the chroot now compiles and runs a program.

--- FR ---

Notre paquet gcc a été bâti une douzaine de fois sans jamais servir à
compiler : l'étage 1 compile avec le gcc d'Ubuntu. Le premier programme qu'on
lui a demandé de lier l'a été dans le chroot d'étage 2, et il a échoué deux
fois.

  collect2: fatal error: cannot find 'ld'

/usr/bin/ld était présent, exécutable, dans le PATH, et répondait pour le même
utilisateur. -B, COMPILER_PATH et trois liens symboliques n'ont rien changé.
strace a tranché en une ligne : il cherchait s390x-linux-gnu-ld, le triplet
DEBIAN, en affichant le nom générique. La configuration de gcc avait
enregistré la copie d'Ubuntu, un fichier qu'aucun système Arch n'aura jamais.
--with-ld et --with-as épinglent désormais des chemins absolus, corrects sur
l'hôte, dans le chroot et sur la cible.

  /usr/bin/ld: cannot find -lgcc_s

package_gcc() déplace libgcc_s{,_asneeded}.so trois répertoires plus bas.
Le second est un script ld et survit ; libgcc_s.so est un symlink dont la
cible est relative à /usr/lib, si bien qu'après le déplacement il ne pointe
plus sur rien. Le seul libgcc_s.so du système pendait dans le vide : -lgcc_s
ne pouvait se résoudre et plus rien ne se liait — pas même
int main(void){return 0;}.

Vérifié : le chroot compile et exécute désormais un programme.

Assisted-by: Claude Opus 5
2026-08-19 08:30:49 -04:00
..
audit.sh [FIX] four hooks the closure's second round needed 2026-08-19 06:24:11 -04:00
binutils.sh [ADD] port patches: gcc front ends, binutils gold, libtool multilib 2026-08-15 21:01:18 -04:00
brotli.sh [REM] sub-packages: four that cost more closure than they carry 2026-08-19 05:28:32 -04:00
coreutils.sh [FIX] selinux: the chroot named a host artefact, not a dependency 2026-08-17 01:33:41 -04:00
curl.sh [ADD] TODO.md: track every divergence from upstream Arch 2026-08-16 05:47:47 -04:00
dbus.sh [FIX] the build host answered questions the target should 2026-08-19 05:28:32 -04:00
e2fsprogs.sh [FIX] four hooks the closure's second round needed 2026-08-19 06:24:11 -04:00
expat.sh [FIX] host defaults: apt was deciding what got built 2026-08-17 02:37:46 -04:00
findutils.sh [FIX] selinux: the chroot named a host artefact, not a dependency 2026-08-17 01:33:41 -04:00
gcc.sh [FIX] gcc: two defects only a chroot could find 2026-08-19 08:30:49 -04:00
gettext.sh [FIX] the build host answered questions the target should 2026-08-19 05:28:32 -04:00
glibc.sh [ADD] devtools stand-ins, and lib32 removal for glibc and gcc 2026-08-15 21:15:01 -04:00
gnutls.sh [FIX] declared, never linked: guile, libisl.so, leancrypto 2026-08-19 05:28:32 -04:00
grep.sh [FIX] grep: the m4 check lives in bootstrap.conf, not bootstrap 2026-08-17 00:00:48 -04:00
kbd.sh [ADD] test-chroot: read the binaries, not the declarations 2026-08-19 06:24:11 -04:00
krb5.sh [FIX] the build host answered questions the target should 2026-08-19 05:28:32 -04:00
libassuan.sh [FIX] canonical CHOST, and a reachable libassuan source 2026-08-16 00:45:50 -04:00
libcap-ng.sh [FIX] four hooks the closure's second round needed 2026-08-19 06:24:11 -04:00
libgcrypt.sh [ADD] libgcrypt: stage 1 consumes its own libgpg-error 2026-08-19 05:28:32 -04:00
libsasl.sh [FIX] four hooks the closure's second round needed 2026-08-19 06:24:11 -04:00
libseccomp.sh [REM] sub-packages: four that cost more closure than they carry 2026-08-19 05:28:32 -04:00
libtool.sh [ADD] port patches: gcc front ends, binutils gold, libtool multilib 2026-08-15 21:01:18 -04:00
lvm2.sh [FIX] lvm2: only device-mapper, and the closure closes 2026-08-19 06:40:50 -04:00
lz4.sh [FIX] libdir: the Debian host hid the libraries from Arch 2026-08-17 01:33:41 -04:00
make.sh [FIX] declared, never linked: guile, libisl.so, leancrypto 2026-08-19 05:28:32 -04:00
openssl.sh [FIX] openssl: s390x is big-endian, drop the little-endian EC path 2026-08-16 22:53:33 -04:00
pacman.sh [FIX] libdir: the Debian host hid the libraries from Arch 2026-08-17 01:33:41 -04:00
pam.sh [ADD] host deps: the tools six packages needed and nobody declared 2026-08-17 01:33:41 -04:00
pinentry.sh [FIX] the build host answered questions the target should 2026-08-19 05:28:32 -04:00
sed.sh [FIX] selinux: the chroot named a host artefact, not a dependency 2026-08-17 01:33:41 -04:00
sqlite.sh [FIX] the build host answered questions the target should 2026-08-19 05:28:32 -04:00
systemd.sh [REM] sub-packages: four that cost more closure than they carry 2026-08-19 05:28:32 -04:00
tar.sh [FIX] selinux: the chroot named a host artefact, not a dependency 2026-08-17 01:33:41 -04:00
zstd.sh [FIX] libdir: the Debian host hid the libraries from Arch 2026-08-17 01:33:41 -04:00