一、出现问题:
1、安装好交叉编译工具后,设置好PATH;
2、在shell终端执行命令“arm-linux-gcc -v”报错:
错误所示为:-bash: /home/wjt/3.4.5/bin/arm-linux-gcc: No such file or directory
一开始以为是自己的环境变量设置出错,查找了半天,结果几分钟就解决了bug。
二、解决方案:
1、先安装ia32-libs库
执行命令:sudo apt-get install ia32-libs 报错:安装任何lib都会持续报错
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
此时需要先后执行命令:
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
再执行命令:sudo apt-get install ia32-libs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lib32ncurses5 lib32z1
E: Package 'ia32-libs' has no installation candidate
安装结果如上,意思是让你安装lib32ncureses5
2、安装lib32ncureses5库
执行命令sudo apt-get install lib32ncurses5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
lib32tinfo5 libc6-i386
The following NEW packages will be installed:
lib32ncurses5 lib32tinfo5 libc6-i386
0 upgraded, 3 newly installed, 0 to remove and 124 not upgraded.
Need to get 2,830 kB of archives.
After this operation, 13.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us./ubuntu bionic-updates/main amd64 libc6-i386 amd64 2.27-3ubuntu1.2 [2,650 kB]
Get:1 http://us./ubuntu bionic-updates/main amd64 libc6-i386 amd64 2.27-3ubuntu1.2 [2,650 kB]
Get:2 http://us./ubuntu bionic-updates/main amd64 lib32tinfo5 amd64 6.1-1ubuntu1.18.04 [79.1 kB]
Get:3 http://us./ubuntu bionic-updates/main amd64 lib32ncurses5 amd64 6.1-1ubuntu1.18.04 [100 kB]
Fetched 268 kB in 43s (6,235 B/s)
Selecting previously unselected package libc6-i386.
(Reading database ... 172452 files and directories currently installed.)
Preparing to unpack .../libc6-i386_2.27-3ubuntu1.2_amd64.deb ...
Unpacking libc6-i386 (2.27-3ubuntu1.2) ...
Selecting previously unselected package lib32tinfo5.
Preparing to unpack .../lib32tinfo5_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking lib32tinfo5 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package lib32ncurses5.
Preparing to unpack .../lib32ncurses5_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking lib32ncurses5 (6.1-1ubuntu1.18.04) ...
Setting up libc6-i386 (2.27-3ubuntu1.2) ...
Setting up lib32tinfo5 (6.1-1ubuntu1.18.04) ...
Setting up lib32ncurses5 (6.1-1ubuntu1.18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
/* 一大堆------- */
3、再检测是否有交叉编译工具
执行命令:arm-linux-gcc -v
Reading specs from /home/wjt/3.4.5/bin/../lib/gcc/arm-linux/3.4.5/specs
Configured with: /work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/work/tools/gcc-3.4.5-glibc-2.3.6 --with-float=soft --with-headers=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux/include --with-local-prefix=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.5
表明系统中有arm-linux-gcc交叉编译工具。