linux系统内核版本:2.6.32-358.el6.x86_64(在64位系统上安装32位程序需要另外安装一些库)
arm-linux-gcc版本:本文安装的是友善之臂tiny6410光盘中自带的arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz
1. 创建工作目录/opt/FriendlyARM/tools/arm-linux-gcc-4.5.1
2. 解压arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz到/opt/FriendlyARM/tools/arm-linux-gcc-4.5.1
3. 将编译器路径系统环境变量
vim /root/.bashrc
在最后添加
export PATH=$PATH:/opt/FriendlyARM/tools/arm-linux-gcc-4.5.1/bin
4. 重启系统
5. 查看arm-linux-gcc版本
arm-linux-gcc -v
错误提示:
-bash: ./arm-linux-gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解决方法:
yum whatprovides ld-linux.so.2
从打印信息中得知缺少库glibc-2.12-1.132.el6.i686
从打印信息中得知缺少库glibc-2.12-1.132.el6.i686
yum install glibc-2.12-1.132.el6.i686
再次执行arm-linux-gcc -v可正常显示
6. 编译测试代码
arm-linux-gcc -o test test.c
错误提示:
/opt/FriendlyARM/tools/arm-linux-gcc-4.5.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
解决方法:
yum whatprovides libz.so.1
从打印信息中得知缺少库zlib-1.2.3-29.el6.i686
yum install zlib-1.2.3-29.el6.i686
yum install zlib-1.2.3-29.el6.i686
再次编译可通过。