This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Installing glibc headers before building bootstrap gcc (was: Re:[PATCH] missing #ifndef inhibit_libc in gcc/config/rs6000/linux.h)
- From: Dan Kegel <dank at kegel dot com>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: Richard Henderson <rth at redhat dot com>, Franz dot Sirl-kernel at lauterbach dot com, gernot dot hillier at siemens dot com, gcc-patches at gcc dot gnu dot org, GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Sun, 09 Nov 2003 16:25:02 -0800
- Subject: Installing glibc headers before building bootstrap gcc (was: Re:[PATCH] missing #ifndef inhibit_libc in gcc/config/rs6000/linux.h)
- References: <200310281705.30364.gernot.hillier@siemens.com> <200310282159.28333@enzo.bigblue.local> <3F9EDDDF.6050403@kegel.com> <200310282243.37881@enzo.bigblue.local> <62295.24.126.73.164.1067381298.squirrel@webmail.pair.com> <20031028235522.GA19659@redhat.com> <20031029051025.GA23565@nevyn.them.org> <3F9F6B0F.4090907@kegel.com> <20031029160844.GA30300@nevyn.them.org>
Daniel Jacobowitz wrote:
On Tue, Oct 28, 2003 at 11:23:59PM -0800, Dan Kegel wrote:
Daniel Jacobowitz wrote:
Sadly, in order to build a proper Linux toolchain, inhibit_libc
is absolutely required, even on Linux. This is because you have
to first build a bootstrap compiler without glibc.
This is a lie.
? The sequence required to build a Linux toolchain without
the build system's headers and libraries leaking in is
glibc: make install-headers (using native compiler)
gcc: make all-gcc install-gcc (with inhibit_libc defined, perhaps
indirectly)
No. That's not at all necessary; just --disable-shared. I build gcc
with just headers and no inhibit_libc every day.
I just tried building a bootstrap compiler without setting
inhibit_libc, that is, without passing the option --with-newlib
(which is customarily used when building bootstrap compilers
precisely because it sets inhibit_libc). The build failed as expected with
In file included from /home/dank/crosstool-0.25/build/powerpc-405-linux-gnu/gcc-3.3.2-glibc-2.3.2/gcc-3.3.2/gcc/tsystem.h:72,
from /home/dank/crosstool-0.25/build/powerpc-405-linux-gnu/gcc-3.3.2-glibc-2.3.2/gcc-3.3.2/gcc/crtstuff.c:62:
/opt/crosstool/powerpc-405-linux-gnu/gcc-3.3.2-glibc-2.3.2/powerpc-405-linux-gnu/include/stdio.h:138:28: bits/stdio_lim.h: No such file or directory
make[1]: *** [crtbegin.o] Error 1
which is the same error I got earlier with the gcc-3.4 bug that
caused inhibit_libc to not be defined (see http://gcc.gnu.org/ml/gcc/2003-08/msg00900.html ).
So either Daniel J. is configuring his bootstrap compiler --with-newlib, or
he's installing the glibc headers more cleverly than me such that he ends up with a working bits/stdio_lim.h.
Now, stdio_lim.h is one of those files that's generated during
glibc's "make install-headers" by running $(CC)
just as errlist-compat.c is. In the past, I ran into trouble
trying to get glibc's Makefiles to generate them, so I bypass them.
Here's the snippet of crosstool.sh which install glibc's headers before
building the bootstrap compiler:
CC=gcc \
${GLIBC_DIR}/configure --host=$TARGET --prefix=/usr \
--build=$BUILD \
--without-cvs --disable-sanity-checks --with-headers=${PREFIX}/${TARGET}/include \
--enable-hacker-mode
if grep -q GLIBC_2.3 ${GLIBC_DIR}/ChangeLog; then
# glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c, which fails without a real cross-compiler.
# Fortunately, we don't need errlist-compat.c, since we just need .h files,
# so work around this by creating a fake errlist-compat.c and satisfying its dependencies.
# Another workaround might be to tell configure to not use any cross options to $(CC).
# The real fix would be to get install-headers to not generate errlist-compat.c.
make sysdeps/gnu/errlist.c
mkdir -p stdio-common
touch stdio-common/errlist-compat.c
fi
make cross-compiling=yes install_root=${PREFIX}/${TARGET} prefix="" install-headers
Should I be doing it some other way?
- Dan