Toolchain: Install system headers before building GCC

GCC determines whether the system's <limits.h> header is usable
and installs a different version of its own <limits.h> header
depending on whether the system header file exists.

If the system header is missing GCC's <limits.h> header does not
include the system header via #include_next.

For this to work we need to install LibC's headers before
attempting to build GCC.

Also, re-running BuildIt.sh "hides" this problem because at that
point the sysroot directory also already has a <limits.h> header
file from the previous build.
This commit is contained in:
Gunnar Beutner 2021-04-12 13:28:33 +02:00 committed by Andreas Kling
parent 3f4e90f32b
commit e95cb252be

View file

@ -239,15 +239,6 @@ pushd "$DIR/Build/$ARCH"
--enable-lto \
${TRY_USE_LOCAL_TOOLCHAIN:+"--quiet"} || exit 1
echo "XXX build gcc and libgcc"
"$MAKE" -j "$MAKEJOBS" all-gcc || exit 1
if [ "$(uname -s)" = "OpenBSD" ]; then
ln -sf liblto_plugin.so.0.0 gcc/liblto_plugin.so
fi
"$MAKE" -j "$MAKEJOBS" all-target-libgcc || exit 1
echo "XXX install gcc and libgcc"
"$MAKE" install-gcc install-target-libgcc || exit 1
echo "XXX serenity libc and libm headers"
mkdir -p "$BUILD"
pushd "$BUILD"
@ -261,6 +252,15 @@ pushd "$DIR/Build/$ARCH"
unset SRC_ROOT
popd
echo "XXX build gcc and libgcc"
"$MAKE" -j "$MAKEJOBS" all-gcc || exit 1
if [ "$(uname -s)" = "OpenBSD" ]; then
ln -sf liblto_plugin.so.0.0 gcc/liblto_plugin.so
fi
"$MAKE" -j "$MAKEJOBS" all-target-libgcc || exit 1
echo "XXX install gcc and libgcc"
"$MAKE" install-gcc install-target-libgcc || exit 1
echo "XXX build libstdc++"
"$MAKE" -j "$MAKEJOBS" all-target-libstdc++-v3 || exit 1
echo "XXX install libstdc++"