building a mipsel-linux cross-compiler
I'm trying to build a cross-compiler for mipsel-linux on an ia32 box, using the
gcc-2.95.4 sources from Debian unstable. I build lots of cross-compilers in the
past (for m68k-linux, powerpc-linux, mipsel-linux, m68k-amigaos on
Linux/{m68k,PPC,ia32) or Solaris/SPARC boxes), but this time I'm really stuck.
Binutils is the easy part:
% apt-get source binutils
% cd binutils-2.11.92.0.12.3
% debian/rules setup
% cd ..
% mkdir binutils-mipsel-linux
% cd binutils-mipsel-linux
% ../binutils-2.11.92.0.12.3/build-tree/binutils-2.11.92.0.12.3/configure --target=mipsel-linux
% make
% make install (as root)
Glibc includes:
% dpkg -x libc6-dev_2.2.5-3_mipsel.deb libc6
% cp -a libc6/usr/include /usr/local/mipsel-linux
Gcc is the though part:
% apt-get source gcc-2.95
% cd gcc-2.95-2.95.4.ds8
% debian/rules control
% cd ..
% patch internals.texi (see patch below)
% mkdir gcc-mipsel-linux
% cd gcc-mipsel-linux
% ../gcc-2.95-2.95.4.ds8/src-native/configure --target=mipsel-linux
% make LANGUAGES=c
First problem:
| Configuring in mipsel-linux/libiberty
| configure: error: installation or configuration problem: C compiler cannot
| create executables.
Looking at the Makefile, it seems we have a `make cross' now. Try to use that:
% make cross
Ah, we need some more includes. Why aren't these found?
% cp -a /usr/local/mipsel-linux/include/* mipsel-linux/libio/
% rm mipsel-linux/libio/libio.h
% make cross
Conflicting declaration between internal and external includes
% patch mathcalls.h (see patch below)
% make cross
| mipsel-linux/libiberty: No targets specified and no makefile found.
Libiberty got configured in gcc-mipsel-linux/libiberty instead of
gcc-mipsel-linux/mipsel-linux/libiberty??
% mv mipsel-linux/libiberty mipsel-linux/libiberty.orig
% mv libiberty mipsel-linux
% ( cd mipsel-linux/libiberty; ../../../gcc-2.95-2.95.4.ds8/src-native/libiberty/configure --target=mipsel-linux)
% make cross
Conflicting declaration between internal and external includes
% patch string.h (see patch below)
% make cross
Cross-compiler built! Let's retry with the good old `make LANGUAGES=c':
% make LANGUAGES=c
No changes, let's install (as root)
% make LANGUAGES=c install
| gcc: ../libiberty/libiberty.a: No such file or directory
Ah, it wants the libiberty.a from gcc-mipsel-linux/mipsel-linux/libiberty
instead of gcc-mipsel-linux/libiberty
% ln -s mipsel-linux/libiberty
% make LANGUAGES=c install
| configure: error: installation or configuration problem: C compiler cannot
| create executables.
| make[1]: *** [p/rts/Makefile] Error 1
| make[1]: Leaving directory `/home/geert/src/gcc-mipsel-linux/gcc'
| make: *** [install-gcc] Error 2
And then I'm really stuck :-( What happened? Building a cross-compiler used to
be very simple (configure --target=xxx-linux; make;make install)!
Anyone with a clue? Thanks!
--- gcc-2.95-2.95.4.ds8/src-native/gcc/p/doc/en/internals.texi.orig Sat Dec 22 12:04:47 2001
+++ gcc-2.95-2.95.4.ds8/src-native/gcc/p/doc/en/internals.texi Sun Feb 17 14:54:17 2002
@@ -260,7 +260,7 @@
``Syntax diagrams'' are a graphical variant of the Backus-Naur Form.
For details about the ``bison'' language, see
-@ref{,the Bison documentation,,bison,the Bison manual}. A short overview
+@ref{the Bison documentation,,bison,the Bison manual}. A short overview
how to pick up some information you might need for programming follows.
Suppose you have forgotten how a variable is declared in Pascal. After some
--- gcc-mipse-linux/mipsel-linux/libio/bits/mathcalls.h.orig Tue Feb 5 02:48:38 2002
+++ gcc-mipse-linux/mipsel-linux/libio/bits/mathcalls.h Mon Feb 18 11:18:17 2002
@@ -147,7 +147,7 @@
#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
/* Return `sqrt(X*X + Y*Y)'. */
-__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+//__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
--- gcc-mipse-linux/mipsel-linux/libio/string.h.orig Tue Feb 5 02:49:19 2002
+++ gcc-mipse-linux/mipsel-linux/libio/string.h Mon Feb 18 11:26:58 2002
@@ -269,8 +269,8 @@
# endif
/* Compare S1 and S2, ignoring case. */
-extern int strcasecmp (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__;
+//extern int strcasecmp (__const char *__s1, __const char *__s2)
+// __THROW __attribute_pure__;
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Reply to: