This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Installing glibc headers before building bootstrap gcc (was: Re: [PATCH] missing #ifndef inhibit_libc in gcc/config/rs6000/linux.h)

On Sun, Nov 09, 2003 at 04:25:02PM -0800, Dan Kegel wrote:
> 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 
> ).
> 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.

The latter.

> 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 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?

I have no idea, but it's clearly a problem with glibc's install-headers
rather than with gcc.  TBH, I cheat: take a look at the contents of
stdio_lim.h, it really doesn't matter for the bootstrap gcc, so I just
copy an arbitrary one in.  I think I touch some other generated header
(gnu/stubs.h?) also.

I have never found time to "fix" this in glibc.

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]