DavidR
DavidR

Reputation: 31

Cross compilation for MIPS architecture

I would like to run an app in a MIPS architecture (BCM6358). I have developed a "Hello World" app like this:

#include <stdio.h>
int main()
{
    printf("Hello World" )  ;
    return 0        ;
}

I have also compiled it like this:

# mips-linux-gnu-gcc -muclibc hallo.c

But when I've run ... it doesn't work:

# libc.so.6 aborted attempt to ... a.out!!  

Of course, libc.so.6 doesn't exist in the MIPS box, but libc.so.0 does.

I have also compiled it like this:

# mips-linux-gnu-gcc -muclibc -mips32 -EB hallo.c -o hallo

However, the output is the same.

I don't know if "-muclibc" is working well because in my Ubuntu machine I don't find anything about libc.so.0 neither uclibc.

root@XXN:/# find / -name libc.so.* -print
/usr/mips-linux-gnu/lib/libc.so.6
/lib/i386-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6
root@XXN:/# find / -name *uclib* -print

Any idea?

Thanks, best regards.

Upvotes: 1

Views: 943

Answers (1)

DavidR
DavidR

Reputation: 31

Yes, the MIPS target has a libc.so and as:

libc.so.6 != uClibc
libc.so.6 == glibc
libc.so.0 == uClibc

I compile with -muclibc.

However, I got it!!! weeeeellll!!

What I have done is to install an old Codesourcery and compile it with static library like this:

# mips-linux-gnu-gcc -muclibc -mips32 -EB -static hallo.c -o hallo

Thanks, best regards.

Upvotes: 1

Related Questions