ubuntu安裝arm-none-eabi-gcc交叉編譯器
本文介紹下安裝arm-none-eabi-gcc交叉編譯器的方法與安裝過程遇到的問題。
首先,下載arm-none-eabi-gcc交叉編譯器包。
下載地址:點這裏
然後copy到ubuntu中,解壓。
只需將arm-none-eabi-gcc所在目錄添加到環境變量即可。
假如解壓目錄放在如下目錄:
操作:
vim /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
#添加此句
export PATH=$PATH:/home/cdb/tool/gcc-arm-none-eabi-5_4-2016q3/bin
保存後,重啓ubuntu或者執行source /etc/profile
至此,交叉編譯器安裝成功,執行arm-none-eabi-gcc測試,發現如下錯誤
由於64位下運行32編譯器缺少相應的庫文件,所以運行時會報錯,需要安裝lib32ncurses5 lib32z1
sudo apt-get install lib32ncurses5 lib32z1
至此,交叉編譯器安裝成功。