[bugs] Re: Bootstrap from scratch broken on glibc based system

Bo Thorsen bo@sonofthor.dk
Sun Jan 20 09:30:00 GMT 2002


On Friday 18 January 2002 22:11, Andi Kleen wrote:
> On Fri, Jan 18, 2002 at 10:09:04PM +0100, Andi Kleen wrote:
> > On Fri, Jan 18, 2002 at 04:05:26PM -0500, Jakub Jelinek wrote:
> > > On Fri, Jan 18, 2002 at 09:53:36PM +0100, Andi Kleen wrote:
> > > > Hallo,
> > > >
> > > > This change broke cross-bootstrapping glibc based systems from
> > > > scratch. It adds an dependency to glibc to the gcc build (for
> > > > stdlib.h and link.h in the target), but glibc cannot be built without
> > > > an gcc build first and gcc needs installed glibc now.  This is an
> > > > problem when cross bootstrapping the x86-64 toolkit from scratch for
> > > > example. Any ideas?
> > >
> > > See the generic part of
> > > http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02605.html
> > > patch.
> >
> > Could you elaborate. Which generic part do you mean exactly ?
>
> Never mind. I see what you mean (missed the inhibit_libc flag on first
> scanning)

This is one way of getting around it. Another is to just install glibc 
headers before gcc. This is what the x86-64 build scripts do:

--- *** ---
#!/bin/bash

# Read pathnames and compiler options
source config

# Set up the links to the kernel include files and make sure version.h is here
mkdir -p $TOOLCHAIN_DIR/$HOSTARCH/include
pushd $TOOLCHAIN_DIR/$HOSTARCH/include
ln -s $LINUX_SOURCE/include/linux .
ln -s $LINUX_SOURCE/include/asm-$KERNELARCH asm
cd $LINUX_SOURCE
make include/linux/version.h
popd

build_dir ct_headers

# Set the sys-include link
mkdir -p $TOOLCHAIN_DIR/$HOSTARCH/include $TOOLCHAIN_DIR/$HOSTARCH/
ln -s $TOOLCHAIN_DIR/$HOSTARCH/include $TOOLCHAIN_DIR/$HOSTARCH/sys-include

# Install glibc headers
unset CC CXX AR RANLIB SIZE STRIP
$GLIBC_SOURCE/configure --prefix=$TOOLCHAIN_DIR/$HOSTARCH --enable-add-ons 
--with-headers=$TOOLCHAIN_DIR/$HOSTARCH/include $HOSTARCH &&
make cross-compiling=yes install-headers &&

# Now fix enough to make gcc compile
cp $GLIBC_SOURCE/include/features.h $TOOLCHAIN_DIR/$HOSTARCH/include &&
mkdir -p $TOOLCHAIN_DIR/$HOSTARCH/include/gnu &&
touch $TOOLCHAIN_DIR/$HOSTARCH/include/gnu/stubs.h

exit $?
--- *** ---

This is all necessary headers needed to do a compilation of a full toolchain. 
I'll update the build page on x86-64.org to include this info.

Bo.

-- 

     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark



More information about the Gcc-bugs mailing list