debian9.6命令安装交叉编译器

1,搜索

guoyanzhang@bogon:~$ apt-cache search gcc-arm-linux-gnueabi*
gcc-arm-linux-gnueabi - GNU C compiler for the armel architecture
gcc-arm-linux-gnueabihf - GNU C compiler for the armhf architecture

 搜索的结果有两个,很显然,两个都是交叉编译器,一个是armel架构,一个是armhf架构。

可参考:https://zhidao.baidu.com/question/1691117630864232868.html,这里面对两个的区别写的还是比较清楚的。

另外, https://blog.csdn.net/kunkliu/article/details/79695829,这篇文章里说,这两个编译的结果不能兼容,大家使用的时候注意点。

2,安装

guoyanzhang@bogon:~$ sudo apt-get install gcc-arm-linux-gnueabi

3,查看是否安装成功

guoyanzhang@bogon:~/test$ dpkg -s gcc-arm-linux-gnueabi
Package: gcc-arm-linux-gnueabi
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 24
Maintainer: Debian GCC Maintainers <[email protected]>
Architecture: amd64
Multi-Arch: foreign
Source: gcc-defaults (1.168)
Version: 4:6.3.0-4
Depends: cpp-arm-linux-gnueabi (>= 4:6.3.0-4), gcc-6-arm-linux-gnueabi (>= 6.3.0-9~)
Recommends: libc6-dev-armel-cross | libc-dev-armel-cross
Suggests: make, manpages-dev, autoconf, automake, libtool, flex, bison, gdb-arm-linux-gnueabi, gcc-doc
Description: GNU C compiler for the armel architecture
 This is the GNU C compiler, a fairly portable optimizing compiler for C.
 .
 This is a dependency package providing the default GNU C cross-compiler
 for the armel architecture.

4,使用

guoyanzhang@bogon:~/test$ sudo apt-get install lsb-core
guoyanzhang@bogon:~/test$ arm-linux-gnueabi-gcc a.c 
guoyanzhang@bogon:~/test$ 

lsb-core的作用,就是可以像其他命令一样tab补全使用了,不用再加目录/usr/bin/使用arm-linux-gnueabi了,否则tab补全不了。(如果还不能补全的话,将/usr/bin下的arm-linux-gnueabi拷贝到/bin下)

这里我没注意,可能是改变了PATH内容,添加了/usr/bin这一项。

参考1:https://blog.csdn.net/ragnaro/article/details/79143914

参考2:https://blog.csdn.net/u010860832/article/details/80627593

猜你喜欢

转载自blog.csdn.net/weixin_39465823/article/details/86508242
今日推荐