This is the mail archive of the gcc@gcc.gnu.org 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: Difficulty building stage 1 MIPS cross compiler from CVS...


On Friday 11 January 2002 03:41, Steven J. Hill wrote:
> Greetings.
>
> I'm trying to build a MIPS cross toolchain and it's been a while
> since I built it out of CVS. Here's my configuration line:
>
> AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib ../gcc-20020110/configure
> --prefix =/opt/toolchains/mips --target=mipsel-linux i686-pc-linux-gnu
> --with-newlib --di sable-shared --enable-languages=c
>
> After compiling for a while I get:
>
> if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
> /opt/build-gcc/gcc/xgcc -B/opt/build-gcc/gcc/
> -B/opt/toolchains/mips/mipsel-linu x/bin/
> -B/opt/toolchains/mips/mipsel-linux/lib/ -isystem /opt/toolchains/mips/mi
> psel-linux/include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings
> -Wst rict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC -g1 
> -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I.
> -I../../gcc-20020110/gcc -I../. ./gcc-20020110/gcc/.
> -I../../gcc-20020110/gcc/config -I../../gcc-20020110/gcc/.. /include
> -fexceptions -c ../../gcc-20020110/gcc/unwind-dw2-fde-glibc.c -o libgcc
> /./unwind-dw2-fde-glibc.o
> ../../gcc-20020110/gcc/unwind-dw2-fde-glibc.c:35:20: stdlib.h: No such file
> or d irectory
> In file included from ../../gcc-20020110/gcc/unwind-dw2-fde-glibc.c:41:
> ../../gcc-20020110/gcc/unwind-pe.h: In function `size_of_encoded_value':
> ../../gcc-20020110/gcc/unwind-pe.h:76: warning: implicit declaration of
> function `abort'
> In file included from ../../gcc-20020110/gcc/unwind-dw2-fde-glibc.c:292:
> ../../gcc-20020110/gcc/unwind-dw2-fde.c: In function `get_cie_encoding':
> ../../gcc-20020110/gcc/unwind-dw2-fde.c:271: warning: implicit declaration
> of fu nction `strlen'
> make[2]: *** [libgcc/./unwind-dw2-fde-glibc.o] Error 1
> make[2]: Leaving directory `/opt/build-gcc/gcc'
> make[1]: *** [libgcc.a] Error 2
> make[1]: Leaving directory `/opt/build-gcc/gcc'
> make: *** [all-gcc] Error 2
>
> It appears that in 'gcc/config/t-linux' we enable the compilation of
> the above unit, but it isn't going to bloody work for obvious reasons
> as glibc hasn't even been built yet. What special configure option am
> I supposed to use to mitigate this? Thanks.

The problem is that the build of gcc now depends on having access to the 
glibc headers for the crosscompilation target. I have solved this in my 
x86-64 scripts by introducing this script that handles setting up all 
necessary include files before any compilation is being done. Feel free to 
take as much as you want from it. You can find the rest of the crossbuild 
suite in www.x86-64.org cvs. What you definately need is the glibc headers, 
and perhaps the fix at the end to it (glibc x86-64 install-headers doesn't 
install features.h and gnu/stubs.h).

In your case, HOSTARCH is mipsel-linux. TOOLCHAIN_DIR is the location of the 
cross compilation tool chain.

#!/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 $?


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