[FIX] gcc: bound bootstrap parallelism; libmagic and patchelf on the host

gcc failed on what looked like a missing header:

  /usr/include/strings.h:23:10: fatal error:
    .../gcc-build/prev-gcc/include/stddef.h: No such file or directory

The file was PRESENT when the tree was inspected afterwards. It is not
missing: it is generated by a rule that another rule consumes without
declaring the dependency, and with MAKEFLAGS=-j16 sixteen jobs win that
race often enough to fail. Read as an absent header, it sends you
hunting through include paths for nothing -- and past a set of host
symlinks that were, this time, innocent.

The bound goes into build() inside the PKGBUILD. My first attempt
exported MAKEFLAGS from the hook, which cannot work: hooks run in their
own bash process and never reach makepkg. gcc is the only package here
that bootstraps itself three times, so the limit is local to it.

util-linux wanted libmagic; curl wanted patchelf. Both installed.

--- FR ---

gcc echouait sur ce qui ressemblait a un en-tete manquant :

  /usr/include/strings.h:23:10: fatal error:
    .../gcc-build/prev-gcc/include/stddef.h: No such file or directory

Le fichier etait PRESENT a l inspection de l arbre apres coup. Il ne
manque pas : il est produit par une regle qu une autre consomme sans
declarer la dependance, et avec MAKEFLAGS=-j16 seize taches gagnent
cette course assez souvent pour echouer. Lu comme un en-tete absent, il
fait fouiller les chemins d inclusion pour rien -- et soupconner des
liens symboliques d hote qui, cette fois, etaient innocents.

La borne va dans build(), a l interieur du PKGBUILD. Ma premiere
tentative exportait MAKEFLAGS depuis le crochet, ce qui ne peut pas
fonctionner : les crochets tournent dans leur propre processus bash et
n atteignent jamais makepkg. gcc est le seul paquet ici a s amorcer
trois fois, la limite lui reste donc locale.

util-linux reclamait libmagic ; curl reclamait patchelf. Poses tous deux.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-16 07:13:33 -04:00
parent 00c3909df5
commit 115ea48fb4

View file

@ -182,3 +182,22 @@ else
echo "gcc: libgccjit ENABLED (second full build of the tree)"
fi
echo "gcc: front ends reduced, multilib off, lib32 removed"
# Bound the parallelism of gcc's own bootstrap, INSIDE the PKGBUILD.
#
# With MAKEFLAGS=-j16 the stage-2 bootstrap raced against itself:
#
# /usr/include/strings.h:23:10: fatal error:
# .../gcc-build/prev-gcc/include/stddef.h: No such file or directory
#
# The file was PRESENT when the tree was inspected afterwards. It is not
# missing -- it is generated by a rule another rule consumes without
# declaring the dependency, and sixteen jobs win that race often enough to
# fail. Read as an absent header, it sends you hunting through include paths
# for nothing.
#
# The setting has to go into build(): this hook runs in its own bash process,
# so exporting MAKEFLAGS here would never reach makepkg. gcc is the only
# package in the list that bootstraps itself three times, so the bound is
# applied here rather than globally.
sed -i '0,/^build() {$/s//build() {\n export MAKEFLAGS="-j8"/' PKGBUILD
grep -A1 '^build() {' PKGBUILD | head -2 | sed 's/^/ /'