ubuntu安装arm-none-eabi-gcc交叉编译器

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

至此,交叉编译器安装成功。

发布了73 篇原创文章 · 获赞 6 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_38240926/article/details/102553452