在linux平台上安裝好的基礎上,開始配置arm-linux-gcc

來源:互聯網
上載者:User

在linux平台上安裝好的基礎上,開始配置arm-linux-gcc,使其正常工作

一,安裝前準備

1,下載並安裝arm-linux-gcc

arm-linux-gcc-4.2.1的版本在http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/這裡可以下載,最新版arm-linux-tools-20080623.tar.gz這個可能是4.2.4的版本,因為下面有編譯4.2.4的方法還有相應的程式碼封裝,build-arm-linux-4.2.14,此版本由於過大,我沒有下載。

下面的這個是ARM官方給的下載連結http://www.codesourcery.com/gnu_toolchains/arm/download.html,然後將HOST選擇為IA32 GNU/Linux,點擊下載就可以了。不過首碼為arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu而不是arm-linux-。。。

       在友善之臂官方網站http://www.arm9.net/download.asp下載arm-linux-gcc4.4.3。

2,刪除之前安裝有舊版本,執行

 [root@localhost ~]# rm -rf /opt/arm

3,對新版本arm-linux-gcc-4.4.3進行解壓(注意,如果我們加上了-C,那麼就會自動解壓到/usr/local/arm/這個目錄下),但是友善之臂按照下列方式解壓,不會解壓到/usr/local/arm/目錄下的,這是因為友善之臂把/usr/local/arm/目錄修改成了 /opt/FriendlyARM/toolschain/,除非自己在把它修改過來

[root@localhost ~]# tar -ivxzf /smbroot/arm-linux-gcc-4.4.3.tar.gz  -C /

4,修改設定檔,將arm-linux-gcc添加到環境變數中,因為arm-linux-gcc的命令是在/usr/local/arm/4.4.3/bin下,其目的通過對全域變數綁定使之能夠在任意一個目錄下能夠執行該命令。

開啟設定檔案

[root@localhost opt]# vi /etc/profile

在開啟的檔案的

# Path manipulation
if [ "$EUID" = "0" ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
        pathmunge /usr/local/arm/4.4.3/bin
fi
或者在檔案末尾添加

export PATH=$PATH:/usr/local/arm/4.4.3/bin

儲存退出

5,立即使新的環境變數生效,不用重啟電腦

[root@localhost opt]#  source /etc/profile

[root@localhost opt]# 

6,檢查是否將路徑加入到PATH:

[root@localhost opt]# echo $PATH

顯示的內容中有/usr/local/arm/4.4.3/bin,說明已經將交叉編譯器的路徑加入PATH。至此,交叉編譯環境安裝完成。

7,測試是否安裝成功

首先,執行find命令查詢一下arm-linux-gcc的位置

[root@localhost ~]# find / -name arm-linux-gcc

/opt/arm/toolschain/4.4.3/bin/arm-linux-gcc
[root@localhost ~]# 

可以看到arm-linux-gcc的位置與環境變數中設定的路徑一致

接下來查詢arm-linux-gcc的版本

[root@localhost bin]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root
--enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3
--with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix
--enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1) 
[root@localhost bin]# 

可以看到arm-linux-gcc的版本號碼,至此,arm-linu-gcc已成功安裝。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.