4

I am cross compiling the open source library oRTP for MIPS processor (little-endian arch). My development system is i386 linux. I run the configure script as

./configure --host=mips-linux

The configure script uses the mips-linux-gnu-gcc compiler and builds the library. However when I try to link the library with an executable, I get undefined symbols saying that the ortp lib is built for big-endian and that the target is little-endian.

Running file command on an existing executable on the target shows

ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, not stripped

And running file on the ortp object file shows

ELF 32-bit MSB relocatable, MIPS, MIPS32 rel2 version 1 (SYSV), with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, not stripped

Even though both are built for MIPS, the existing executable is LSB where as the ortp compiled object file is MSB.

How do I compile for MIPS and LSB so that linking goes fine?

1
  • Well, I feel terrible about myself. I explicitly gave the CC compiler as mipsel-linux-gcc and the issue was resolved. CC=/path/to/mipsel-linux-gcc ./configure --host=mips-linux
    – sthustfo
    Sep 2, 2011 at 9:41

1 Answer 1

7

Well, I feel terrible about myself. I explicitly gave the CC compiler as mipsel-linux-gcc and the issue was resolved.

CC=/path/to/mipsel-linux-gcc ./configure --host=mips-linux

So the way to go is to use mipsel-linux-gcc compiler in case you are compiling for little endian mips processor and use mips-linux-gcc only compiler for big-endian mips processtors.

1
  • 2
    I ran into the same problem, but mipsel-linux-gcc wasn't available in the toolchain I was using. I had to use the '-EL' option to cross compile for a little endian architecture. Jun 6, 2014 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.