Skip to content

Commit

Permalink
Toolchain: Install system headers before building GCC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gunnarbeutner authored and awesomekling committed Apr 12, 2021
1 parent 3f4e90f commit e95cb25
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Toolchain/BuildIt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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++"
Expand Down

0 comments on commit e95cb25

Please sign in to comment.