玩转mini2440开发板之【64位Ubuntu系统无法运行arm-linux-gcc】

版权声明:个人心得,欢迎来信来函交流。转载请注明出处! https://blog.csdn.net/LEON1741/article/details/86562895

前段时间由于工作原因,将虚拟机重装了,由原来的Ubuntu 12.04(32位)升级成了Ubuntu 16.04(64位)。自然,原来安装在Ubuntu 12.04中的所有mini2440开发板相关的工具和源码,都要重装一遍。今天刚好得空,于是就开始整。

第一步当然是安装交叉编译器了,仍然是友善之臂arm-linux-gcc 4.4.3的版本,按照官方手册的步骤,直接解压,然后添加环境变量,一气呵成。可是,当我注销完重新登录之后,输入命令时,系统却给出了一个出错提示:

leon@Ubuntu:~$ arm-linux-gcc -v
/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc: 15: exec: /opt/FriendlyARM/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc: not found

之前多次安装都很正常,这次怎么就出错了呢?而且这个错误很奇怪,以前从未遇到过类似的错误。反复检查了.bashrc文件之后,确认我配置的环境变量是没有问题的,那么问题究竟出在哪里呢?

思来想去,直接跑到arm-linux-gcc的目录下,直接运行原始文件,错误依旧:

leon@Ubuntu:/opt/FriendlyARM/toolschain/4.4.3/bin$ ./arm-linux-gcc -v
./arm-linux-gcc: 15: exec: /opt/FriendlyARM/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc: not found

此时,不经意的对原始文件进行了一下分析,却有了一个惊人的发现:

leon@Ubuntu:/opt/FriendlyARM/toolschain/4.4.3/bin$ file /opt/FriendlyARM/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc
/opt/FriendlyARM/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.9, BuildID[sha1]=07b2409f8703af43f9018f5864fb10bbafe9039e, not stripped

这里有个关键字,让我一下找到了问题的源泉:“32-bit“。因为我现在的系统是64位的,无法兼容运行32位的交叉编译器,必须安装一个32位的库才可以。解决办法如下:

sudo apt-get install lib32ncurses5 lib32z1

装完之后,再次输入命令,一切OK!

leon@Ubuntu:~$ arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1) 

猜你喜欢

转载自blog.csdn.net/LEON1741/article/details/86562895