MIPS 的交叉编译器似乎无法创建有效的程序
Cross compiler for MIPS doesn't seem to create valid programs
我已经使用 buildroot 设置了一个交叉编译器。
目标设备是 运行ning Linux,它有一个 MIPS 处理器(它是 Dreambox dm500hd)。
Buildroot 配置(仅我更改的内容):
- 目标配置
- 架构:MIPS(小端)
- 架构变体:通用 MIPS32
- 工具链配置
- [*] 启用 C++ 支持
- [*] 启用编译器link-时间优化支持
我已经按照设置程序进行操作,buildroot 使编译器成功(mips-linux-gcc 和 g++)。
Hello World 文件 (test-mips.cpp)
#include <iostream>
using namespace std;
int main() {
cout << "hello world";
return 0;
}
我可以编译 Hello World,但是当我在目标设备上 运行 时会抛出一个错误:
dm500hd:~$ ./test-mips
./test-mips: line 1: EL@4▒�P4: not found
./test-mips: line 1: syntax error: unexpected word (expecting ")")
仅当我为小端构建编译器时才会出现奇怪的字符:使用大端编译的程序的错误是相同的,但用空格代替 ▒�
。
我尝试了小端和大端,但问题是一样的。我是不是在配置buildroot的时候做错了什么?
注: cat /proc/cpuinfo
游戏我这个结果。我应该更改架构变体吗?
system type : BCM7413B1 STB platform
processor : 0
cpu model : Brcm4380 V4.4 FPU V0.1
BogoMIPS : 403.45
cpu MHz : 405.010
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : no
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
processor : 1
cpu model : Brcm4380 V4.4 FPU V0.1
BogoMIPS : 403.45
cpu MHz : 405.010
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : no
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
您 运行 在您的目标系统上使用 Buildroot 生成的根文件系统吗?或者您只是使用 Buildroot 工具链构建您的程序,并将其移动到目标上的现有文件系统?
在后一种情况下,不要指望开箱即用。您必须确保您的程序与目标系统上已存在的系统重置 ABI 兼容。
我已经使用 buildroot 设置了一个交叉编译器。
目标设备是 运行ning Linux,它有一个 MIPS 处理器(它是 Dreambox dm500hd)。
Buildroot 配置(仅我更改的内容):
- 目标配置
- 架构:MIPS(小端)
- 架构变体:通用 MIPS32
- 工具链配置
- [*] 启用 C++ 支持
- [*] 启用编译器link-时间优化支持
我已经按照设置程序进行操作,buildroot 使编译器成功(mips-linux-gcc 和 g++)。
Hello World 文件 (test-mips.cpp)
#include <iostream>
using namespace std;
int main() {
cout << "hello world";
return 0;
}
我可以编译 Hello World,但是当我在目标设备上 运行 时会抛出一个错误:
dm500hd:~$ ./test-mips
./test-mips: line 1: EL@4▒�P4: not found
./test-mips: line 1: syntax error: unexpected word (expecting ")")
仅当我为小端构建编译器时才会出现奇怪的字符:使用大端编译的程序的错误是相同的,但用空格代替 ▒�
。
我尝试了小端和大端,但问题是一样的。我是不是在配置buildroot的时候做错了什么?
注: cat /proc/cpuinfo
游戏我这个结果。我应该更改架构变体吗?
system type : BCM7413B1 STB platform
processor : 0
cpu model : Brcm4380 V4.4 FPU V0.1
BogoMIPS : 403.45
cpu MHz : 405.010
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : no
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
processor : 1
cpu model : Brcm4380 V4.4 FPU V0.1
BogoMIPS : 403.45
cpu MHz : 405.010
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : no
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
您 运行 在您的目标系统上使用 Buildroot 生成的根文件系统吗?或者您只是使用 Buildroot 工具链构建您的程序,并将其移动到目标上的现有文件系统?
在后一种情况下,不要指望开箱即用。您必须确保您的程序与目标系统上已存在的系统重置 ABI 兼容。