开发者

mips compilation LSB MSB

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 s开发者_如何学Co that linking goes fine?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜