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