$ ls /opt
gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz google
$
$ ls
test.c
$ export PATH=/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin:$PATH
$ export ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
$ export CC=aarch64-linux-gnu-gcc
$ arm-linux-gnueabihf-gcc test.c
$ file test.c
test.c: C source, ASCII text
$ ls
a.out test.c
$ file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=b67ca6bf3f1eba481dc6bf4ecaa59885f1565e31, with debug_info, not stripped
$ cat test.c
#include <stdio.h>
int main(int argc, char *argv[])
{
return 0;
在linux下交叉编译出适用树莓派ARM架构的可执行程序
https://m.linuxidc.com/Linux/2019-05/158608.htm
本文展示了如何在Linux环境下使用GCC交叉编译工具链,设置环境变量,编译并创建适用于树莓派ARM架构的32位可执行文件。通过交叉编译,可以将源代码转换为在不同架构上运行的目标程序。

682

被折叠的 条评论
为什么被折叠?



