MIPS的交叉编译器似乎无法创建有效的程序

时间:2017-07-21 16:31:40

标签: linux cross-compiling mips32 buildroot

我已经使用buildroot设置了交叉编译器 目标设备运行Linux并且它有一个MIPS处理器(它是Dreambox dm500hd)。 Buildroot配置(只有我改变的事情):

  • 目标配置
    • 架构:MIPS(小端)
    • 架构变体:通用MIPS32
  • 工具链配置
    • [*]启用C ++支持
    • [*]启用编译器链接时优化支持

我已按照设置步骤进行操作,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 ")")

只有我为little-endian构建编译器才会出现奇怪的字符:使用big-endian编译的程序的错误是相同的,但是使用空格而不是▒�
我尝试了小端和大端,但问题是一样的。在配置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

1 个答案:

答案 0 :(得分:2)

您是否在目标系统上运行Buildroot生成的根文件系统?或者您是刚刚使用Buildroot工具链构建程序,并将其移动到目标上的现有文件系统?

在后一种情况下,不要期望开箱即用。您必须确保您的程序与目标系统上已存在的系统重置兼容。