Ubuntu安裝ARM架構GCC工具鏈(ubuntu install ARM toolchain)最簡單辦法


一、安裝ARM-Linux-GCC工具鏈

  只需要一句命令:

  sudo apt-get install gcc-arm-linux-gnueabi

  前提是你的Ubuntu系統版本是官網支持的最新的版本,若不是,請升級。執行以上命令即可。

 

二、使用工具鏈

  注意!這里不能使用 gcc 命令來召喚它。它的名字是 arm-linux-gnueabi-gcc 。如果出現 Command Not Found,請關閉Terminal,再重新打開。再不行,就變成超級用戶,把它添加到 PATH 中。

  Tips:查看安裝位置。

     首先你要取得超級用戶權限(臨時取得權限可用命令:sudo -i)

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

 

參考資料:

其一,來自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:

翻譯:對於ARM-Linux應用開發,最好的選擇是安裝了ARM工具鏈的x86 Linux主機。在Ubuntu桌面電腦中,你可以使用下面的命令安裝ARM工具鏈。

apt-get install gcc-arm-linux-gnueabi 

After toolchain installation you can use the following command for cross compilation:

翻譯:安裝完工具鏈后,你要用下面的命令進行交叉編譯:

gcc-arm-linux-gnueabi-gcc -o hello hello.c 

Using 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的開發組織,這對於你的工作將會是個很好的參考。

 

源鏈接:http://stackoverflow.com/questions/14564978/compiling-a-linux-program-for-arm-architecture-running-on-a-host-os

其二,來自 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, not gcc-arm-linux-gnueabi that you mention. So, standard name for CodeSourcery gcc would be arm-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 using locate arm-none-linux-gnueabi-gcc, however you may need to force to update your locate db using sudo updatedb before locatewill work properly.

After you have identified where your CodeSourcery is installed, add it your PATH by editing ~/.bashrclike this:

PATH=/opt/arm-2010q1/bin:$PATH

Also, it is customary and very convenient to define

CROSS_COMPILE=arm-none-linux-gnueabi-

in your .bashrc, because with CROSS_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 } 錯誤。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM