Subject: building mips cross compiler -- an error when compiling glibc

From: [email-masked]
Date: Thu, 15 Apr 2004 22:52:20 -0400 (EDT)

Hi, I'm building a mips cross compiler on a i686 machine. The sources I
used are:
gcc-3.2.2
glibc-2.3.2
binutils-2.14.90.0.8
linux-2.4.20

I can successfully finish binutils installation and gcc bootstrap
installation. I also finished copying kernel headers. Then I met a problem
when compiling glibc. The error is like this:
... ...
/home/xmt/mips/bin/mipsel-linuxelf-gcc ../sysdeps/unix/sysv/linux/sa_len.c
-c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings
-mabi=32 -mips3
     -I../include -I. -I/home/doudou/build-glibc/socket -I.. -I../libio 
-I/home/doudou/build-glibc -I../sysdeps/mips/elf
-I../linuxthreads/sysdeps/unix/sysv/linux/mips
-I../linuxthreads/sysdeps/unix/sysv/linux
-I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread
-I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix
-I../linuxthreads/sysdeps/mips -I../sysdeps/unix/sysv/linux/mips
-I../sysdeps/unix/sysv/linux -I../sysdeps/gnu
-I../sysdeps/unix/common -I../sysdeps/unix/mman
-I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/mips
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/mips/mipsel
-I../sysdeps/mips/fpu -I../sysdeps/mips -I../sysdeps/wordsize-32
-I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64
-I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic 
-nostdinc -isystem
/home/xmt/mips/bin/../lib/gcc-lib/mipsel-linuxelf/3.2.2/include
-isystem /home/xmt/mips/include/ -D_LIBC_REENTRANT -D_LIBC_REENTRANT
-include ../include/libc-symbols.h  -DPIC     -o
/home/doudou/build-glibc/socket/sa_len.o
In file included from /home/xmt/mips/include/linux/config.h:4,
                 from /home/xmt/mips/include/asm/types.h:12,
                 from ../sysdeps/unix/sysv/linux/netatalk/at.h:22,
                 from ../sysdeps/unix/sysv/linux/sa_len.c:22:
/home/xmt/mips/include/linux/autoconf.h:1:2: #error Invalid kernel header
included in userspace
make[2]: *** [/home/doudou/build-glibc/socket/sa_len.o] Error 1
make[2]: Leaving directory `/home/doudou/glibc-2.3.2/socket'
make[1]: *** [socket/subdir_lib] Error 2
make[1]: Leaving directory `/home/doudou/glibc-2.3.2'
make: *** [all] Error 2

The first error is at autoconf.h. My configure command line is:

CC="/home/xmt/mips/bin/mipsel-linuxelf-gcc" CFLAGS="-O2 -mips3 -mabi=32"
AR="/home/xmt/mips/bin/mipsel-linuxelf-ar"
RANLIB="/home/xmt/mips/bin/mipsel-linuxelf-ranlib"
../glibc-2.3.2/configure --prefix=/home/xmt/mips/ --host=mipsel-linuxelf
--build=i686-pc-linux-gnu --without-tls --without-__thread
--enable-add-ons=linuxthreads --enable-kernel=2.4.20 --with-gd=no
--without-cvs --disable-profile --with-headers="/home/xmt/mips/include/"

Any ideas on how to solve this problem? Thanks.

Sam
---------
UMBC

---

From: Jørg Ulrich Hansen <[email-masked]>
Date: Tue, 20 Apr 2004 09:44:47 +0200

a good choice would be www.kegel.com/crosstool, that worked for me.

If you are doing embedded and want to use uclibc on your target then uclibc
toolchain http://www.uclibc.org/toolchains.html is a good choice.

Both take care of any patches needed.

That has also worked for me.

Jorg