只須要一句命令:linux
sudo apt-get install gcc-arm-linux-gnueabi
前提是你的Ubuntu系統版本是官網支持的最新的版本,若不是,請升級。執行以上命令便可。ubuntu
注意!這裏不能使用 gcc 命令來召喚它。它的名字是 arm-linux-gnueabi-gcc 。若是出現 Command Not Found,請關閉Terminal,再從新打開。再不行,就變成超級用戶,把它添加到 PATH 中。windows
Tips:查看安裝位置。bash
首先你要取得超級用戶權限(臨時取得權限可用命令:sudo -i)app
root@ql-virtual-machine:~# locate arm-linux-gnueabi-gcc /usr/bin/arm-linux-gnueabi-gcc /usr/bin/arm-linux-gnueabi-gcc-4.6 /usr/share/man/man1/arm-linux-gnueabi-gcc-4.6.1.gz /usr/share/man/man1/arm-linux-gnueabi-gcc.1.gz
參考資料:ide
其一,來自Stackoverflow,關於在Ubuntu或者Window安裝ARM工具鏈的回答。工具
For ARM-Linux application development the preferable choice is a Linux Host(x86) machine with a ARM toolchain installed in it. In Ubuntu Desktop machine you can use the following command to install ARM toolchain:this
翻譯:對於ARM-Linux應用開發,最好的選擇是安裝了ARM工具鏈的x86 Linux主機。在Ubuntu桌面電腦中,你能夠使用下面的命令安裝ARM工具鏈。spa
apt-get install gcc-arm-linux-gnueabiAfter toolchain installation you can use the following command for cross compilation:.net
翻譯:安裝完工具鏈後,你要用下面的命令進行交叉編譯:
gcc-arm-linux-gnueabi-gcc -o hello hello.cUsing this toolchain you can cross-compile your C program using Standard C library without the need of startup code. Applications can be cross-compiled at your Host Linux(x86) platform and run on Target Linux(ARM) platform.
Windows version of ARM-Linux Toolchain is also available. You can get it from here.
Linaro Developers Wiki - an open organization focused on improving Linux on ARM, will be a good reference for your work.
翻譯:使用這個工具鏈,你能夠用C標準庫來交叉編譯你的C程序,而無需startup code?你的程序能夠在你的x86的Linux主機上交叉編譯而後直接運行在Linux(ARM)平臺上。 ARM-Linux工具鏈的windows版本也是可用的,你能夠從這裏獲取。 Linaro Developers Wiki - 一個致力於改進ARM平臺Linux的開發組織,這對於你的工做將會是個很好的參考。
其二,來自 askUbuntu,關於在Ubuntu上如何安裝ARM工具鏈的回答。
.....However, if you're looking for an ARM cross-compiler, there is one pre-packaged in Ubuntu, which may be easier to get running. It's in the
gcc-arm-linux-gnueabi
package - to install it:翻譯:可是,若是你正在尋找一個 ARM 平臺的交叉編譯器,在Ubuntu中卻是有一個打包好的,它或許比較容易運行。它在 gcc-arm-linux-gnueabi 包中,你能夠這樣安裝它:sudo apt-get install gcc-arm-linux-gnueabi
源連接:http://askubuntu.com/questions/65630/installing-gnu-arm-toolchain
其三,來自stackoverflow。關於如何使用及添加到PATH方法。
CodeSourcery convention is to use prefix
arm-none-linux-gnueabi-
for all executables, notgcc-arm-linux-gnueabi
that you mention. So, standard name for CodeSourcery gcc would bearm-none-linux-gnueabi-gcc
.After you have installed CodeSourcery G++, you need to add CodeSourcery directory into your
PATH
.Typically, I prefer to install CodeSourcery into directory like
/opt/arm-2010q1
or something like that. If you don't know where you have installed it, you can find it usinglocate arm-none-linux-gnueabi-gcc
, however you may need to force to update your locate db usingsudo updatedb
beforelocate
will work properly.After you have identified where your CodeSourcery is installed, add it your PATH by editing
~/.bashrc
like this:PATH=/opt/arm-2010q1/bin:$PATHAlso, it is customary and very convenient to define
CROSS_COMPILE=arm-none-linux-gnueabi-in your
.bashrc
, because withCROSS_COMPILE
defined, most tools will automatically use proper compiler for ARM compilation without you doing anything.
源連接:http://stackoverflow.com/questions/14180185/gcc-arm-linux-gnueabi-command-not-found
————————————進展——————————————
安裝交叉編譯器。另注:經實測,此編譯鏈不適合mini2440。只有官方光盤裏的arm-liinux-gcc4.3編譯出的程序才能在mini2440上運行。
此編譯器編譯後的helloworld在mini2440上老是出現unexpected } 錯誤。