gpt4 book ai didi

gcc - mips 编译 LSB MSB

转载 作者:行者123 更新时间:2023-12-03 02:00:07 64 4
gpt4 key购买 nike

我正在交叉编译 MIPS 处理器(little-endian arch)的开源库 oRTP。我的开发系统是i386 linux。我将配置脚本运行为

./configure --host=mips-linux

配置脚本使用 mips-linux-gnu-gcc 编译器并构建库。然而,当我尝试将库与可执行文件链接时,我得到 undefined symbol ,表明 ortp 库是为大端字节序构建的,而目标是小端字节序。

对目标上的现有可执行文件运行 file 命令显示

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

在 ortp 对象文件上运行 file 显示

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

尽管两者都是为 MIPS 构建的,但现有的可执行文件是 LSB,而 ortp 编译的目标文件是 MSB。

如何编译 MIPS 和 LSB 以便链接正常?

最佳答案

嗯,我对自己感觉很糟糕。我明确将 CC 编译器指定为 mipsel-linux-gcc,问题得到了解决。

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

因此,如果您要针对小端 mips 处理器进行编译,则最好使用 mipsel-linux-gcc 编译器,而对于大端 mips 处理器则仅使用 mips-linux-gcc 编译器。

关于gcc - mips 编译 LSB MSB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7281366/

64 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com