1、在网上下载arm-linux-gcc 软件
2、在linux下进行解压
3、相对解压的目录/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc -o name name.c 命令进行编译
4、如果编译没有报错,则成功
5、如果编译报错
a、在64系统里执行32位程序如果出现/lib/ld-linux.so.2:
bad ELF interpreter: No such file or directory,安装下glic即可
则需要输入命令:# yum install glibc.i686
b、如果出现error while loading shared libraries: libz.so.1:
cannot open shared object file: No such file or directory
则需要输入命令:# yum install zlib.i686
c、如果出现 /libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1:
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
则需要输入命令:# yum -y install libstdc*
另外若当有缺少共享库的报错:
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory则yum list | grep libstdc++.so.6
会发现一系列相关的软件
使用yum install 命令 将上面一些libstdc++ 相关软件进行安装,便可正常编译
6、对编译之后的可执行文件,进行相关的file name 确认交叉编译是否成功
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
看见ARM则表示交叉编译成功