【发布时间】:2020-12-31 00:22:08
【问题描述】:
我正在尝试使用 ubuntu 服务器 20.04.1 LTS 在树莓派 4 上编译代码。我正在使用 gcc 编译它,每次我在成功编译后尝试运行文件时都会显示
-bash: ./out: cannot execute binary file: Exec format error
当我在 out 上执行文件命令时,我知道 ARM cpu 是 64 位的
out: ELF 64-bit LSB relocatable, ARM aarch64, version 1(SYSV), not stripped
这是我要运行的源代码
#include <stdio.h>
#include <stdlib.h>
int main(){
printf("Hello World!");
return 0;
}
这是我正在运行的 gcc 命令
gcc -march=native -ctest.c -oout
【问题讨论】:
标签: c linux raspberry-pi4