交叉编译工具链的安装

步骤1:打开虚拟机,在/usr/local/下创建/usr/local/arm文件夹
步骤2:先将安装包从Windows中弄到linux中去。可以用共享文件夹,也可以用Samba,也可以cuteftp。
步骤3:解压。tar -jxvf arm-2009q3.tar.bz2
到此相当于程序已经安装完毕,真正的应用程序安装在/usr/local/arm/arm-2009q3/bin目录下

安装后的测试

到真正的应用程序的安装目录下(也就是/usr/local/arm/arm-2009q3/bin),去执行arm-linux-gcc -v
执行方法是:./arm-none-linux-gnueabi-gcc -v
执行后可以得到一长串输出,其中有“gcc version 4.4.1 ”字样,即表示安装成功。

遇到失败的提示

执行./arm-none-linux-gnueabi-gcc -v
提示

bash: ./arm-none-linux-gnueabi-gcc: No such file or directory

百度相关问题大概为64位Ubuntu系统安装32位程序需要安装相应的32位兼容包,百度给出以下解决方案:

1.执行:sudo apt-get install lib32z1

结果

root@ubuntu:/usr/local/arm/arm-2009q3/bin# sudo apt-get install lib32z1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.18.0-10 linux-headers-4.18.0-10-generic linux-image-4.18.0-10-generic
  linux-modules-4.18.0-10-generic linux-modules-extra-4.18.0-10-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libc6-i386
The following NEW packages will be installed:
  lib32z1 libc6-i386
0 upgraded, 2 newly installed, 0 to remove and 220 not upgraded.
Need to get 2,723 kB of archives.
After this operation, 14.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://us.archive.ubuntu.com/ubuntu cosmic/main amd64 libc6-i386 amd64 2.28-0ubuntu1
  Temporary failure resolving 'us.archive.ubuntu.com'
Err:2 http://us.archive.ubuntu.com/ubuntu cosmic/main amd64 lib32z1 amd64 1:1.2.11.dfsg-0ubuntu2
  Temporary failure resolving 'us.archive.ubuntu.com'
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-i386_2.28-0ubuntu1_amd64.deb  Temporary failure resolving 'us.archive.ubuntu.com'
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/z/zlib/lib32z1_1.2.11.dfsg-0ubuntu2_amd64.deb  Temporary failure resolving 'us.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


结果依旧不行。

2.执行:sudo apt-get install lib32ncurses5 lib32z1 lib32stdc++6 libstdc++6

结果

root@ubuntu:/usr/local/arm/arm-2009q3/bin# ./arm-none-linux-gnueabi-gcc -v
bash: ./arm-none-linux-gnueabi-gcc: No such file or directory
root@ubuntu:/usr/local/arm/arm-2009q3/bin# sudo apt-get install  lib32ncurses5 lib32z1 lib32stdc++6 libstdc++6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package lib32ncurses5
root@ubuntu:/usr/local/arm/arm-2009q3/bin#


结果依旧不行。

3.执行sudo apt-get install ia32-libs

结果

root@ubuntu:/usr/local/arm/arm-2009q3/bin# 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:
  lib32z1

E: Package 'ia32-libs' has no installation candidate


结果依旧不行。

4.执行:sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

结果

root@ubuntu:/usr/local/arm/arm-2009q3/bin# sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package lib32ncurses5
E: Unable to locate package lib32bz2-1.0
E: Couldn't find any package by glob 'lib32bz2-1.0'
E: Couldn't find any package by regex 'lib32bz2-1.0'
root@ubuntu:/usr/local/arm/arm-2009q3/bin# 


结果依旧不行。

截止当前暂时没找到解决的办法,2019年9月29日00:26:32

5.尝试更新Ubuntu源,执行:sodo apt-get update

结果

root@ubuntu:/etc/apt# apt-get update
Err:1 http://us.archive.ubuntu.com/ubuntu cosmic InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Err:2 http://us.archive.ubuntu.com/ubuntu cosmic-updates InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Err:3 http://security.ubuntu.com/ubuntu cosmic-security InRelease            
  Temporary failure resolving 'security.ubuntu.com'
Err:4 http://packages.microsoft.com/repos/vscode stable InRelease            
  Temporary failure resolving 'packages.microsoft.com'
Err:5 http://us.archive.ubuntu.com/ubuntu cosmic-backports InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/cosmic/InRelease  Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/cosmic-updates/InRelease  Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/cosmic-backports/InRelease  Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/cosmic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://packages.microsoft.com/repos/vscode/dists/stable/InRelease  Temporary failure resolving 'packages.microsoft.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@ubuntu:/etc/apt# 


头大更新不了。

2019年9月29日01:13:04

有新的发现

昨晚弄得头晕脑胀,继续昨晚的apt-get update连接不上,今天下班回来,打开虚拟机浏览器发现网页打不开,原来是虚拟机网络出现了故障。
百度了一下Ubuntu无法联网找到一下解决办法:
sudo service network-manager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo service network-manager start
验证浏览器,发现网络已正常。
1.打开Ubuntu的Software & Updates把更新源切换至国内的阿里云的源http//:mirrors.aliyun.com/ubuntu
2.执行:sudo apt-get install lib32z1成功
3.执行:./arm-none-linux-gnueabi-gcc -v成功显示相应的版本号。

至此GCC交叉编译工具链安装成功。??ヽ(°▽°)ノ?

2019年9月29日20:04:26

最后修改:2019 年 09 月 29 日
如果觉得我的文章对你有用,请随意赞赏