在Debian中进行交叉编译,您需要安装交叉编译工具链
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
arm-linux-gnueabihf-gcc --version
hello.c的文件,输入以下内容:#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
arm-linux-gnueabihf-gcc -o hello hello.c
hello的可执行文件。这个文件是为ARM架构编译的,可以在ARM设备上运行。注意:如果您需要进行其他架构的交叉编译,只需安装相应的交叉编译工具链即可。例如,对于MIPS架构,您可以安装gcc-mips-linux-gnu。