You are not logged in.

#1 2012-11-17 15:15:03

Registered: 2012-11-17
Posts: 2

Compile issues with cross-mipsel-linux-gnu-gcc

I'm trying to set up some sort of cross-compilation environment in order to compile software for a MIPS device.

I installed cross-mipsel-linux-gnu-gcc (4.7.2-1) along with cross-mipsel-linux-gnu-binutils (2.22-1). Then I tried to compile a simple Hello World, and the result was as follows:

[mcmlxxxvi@deepspace1 hello-world]$ cat hello.c 
#include <stdio.h>

int main()
	printf("Hello World!\n");
	return 0;
[mcmlxxxvi@deepspace1 hello-world]$ mipsel-linux-gnu-gcc hello.c 
hello.c:1:19: fatal error: stdio.h: No such file or directory
compilation terminated.
[mcmlxxxvi@deepspace1 hello-world]$ mipsel-linux-gnu-gcc hello.c  -I/usr/include
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtend.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

I know I generally need a compatible glibc build, but a) there isn't a package pre-built for MIPS as the compiler, and b) there is no mention of glibc in either gcc or binutils' AUR pages. So I thought that these two packages were somehow supposed to be sufficient - and they aren't.

I found a tutorial on setting up cross-compilation for MIPS and I tried to build libc, but as I used the gcc and bunutils AUR pacakges instead of going straight for the source, and, probably, as the tutorial is geared towards slightly older versions, I did not succeed. configure produced only a config.log and I wasn't able to make.

So, how are cross-mipsel-linux-gnu-gcc and cross-mipsel-linux-gnu-binutils supposed to be used? How do I need to set up my environment in order to be able to invoke the MIPS gcc the same way as my regular gcc?

Thanks in advance.


Board footer

Powered by FluxBB