bash:./ mips-linux-gnu-gcc:无法执行二进制文件错误

jun*_*ies 3 gcc mips toolchain

我最近mips-linux-gnu-gcc在我的linux机器上安装了一个基于i686 的crosstool.当我想编译一些代码时,它向我显示了错误.

每个安装步骤都遵循http://developer.mips.com/tools/compilers/open-source-toolchain-linux/

安装完crosstool之后,我写了一个简单的helloworld C文件,如下所示:

    #include<stdio.h>
    int main(void)
    {
        printf("Hello World!\n");
        return 0;
    }
Run Code Online (Sandbox Code Playgroud)

但是当我跑步时:

    /mips-linux-gnu-gcc hello.c -o hello -static
Run Code Online (Sandbox Code Playgroud)

编译器只是打印错误:

    bash: ./mips-linux-gnu-gcc: cannot execute binary file
Run Code Online (Sandbox Code Playgroud)

我想知道我可能在某些方面犯了一些错误,但我无法弄明白.

也许有些人可以帮助我,我对这个问题感到困惑.

小智 7

您从MIPS下载的编译器是64位可执行文件.你在运行32位主机吗?

如果您需要针对MIPS GNU/Linux的32位主机的交叉编译器,请考虑使用Sourcery CodeBench Lite编译器来实现MIPS GNU/Linux目标:

适用于MIPS GNU/Linux的Sourcery CodeBench Lite

上面的Sourcery CodeBench工具链接来自MIPS页面,距您提供的链接只有一层:

MIPS编译器页面