ubuntu下的arm-linux-gcc 安装
一、通过源安装:
使用如下命令进行arm-linux-gcc
的安装:
sudo apt-get install gcc-arm-linux-gnueabihf
使用如下命令进行arm-linux-g++
的安装:
sudo apt-get install g++-arm-linux-gnueabihf
卸载时使用如下命令进行移植:
(1)、arm-linux-gcc
sudo apt-get remove gcc-arm-linux-gnueabihf
(2)、`arm-linux-g++``
sudo apt-get remove g++-arm-linux-gnueabihf
二、通过解压文件安装
注意:本文件的安装是在32位系统下进行的,如果Ubuntu系统不是32位的,则使用其他方式。或者安装在64ubuntu系统下安装32框架。
1.解压文件
下载arm-linux-gcc-4.4.3.tar.gz
解压 tar zxvf arm-linux-gcc-4.4.3.tar.gz
2.建立目录
sudo mkdir /usr/local/arm-linux-gcc
3.复制文件
sudo cp -r /opt/FriendlyARM/toolschain/4.4.3 /usr/local/arm
4.配置环境变量
4.1 修改/etc/bash.bashrc文件
sudo gedit /etc/bash.bashrc
在最后加上 export PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin
source /root/.bashrc或者./etc/bash.bashrc
4.2 修改/etc/profile文件
sudo gedit /etc/profile
增加路径设置,在末尾添加如下(文本修改):
export PATH=$PATH:/usr/local/arm/4.4.3/bin
执行命令:source /etc/profile
4.3 修改/etc/environment文件
sudo gedit /etc/environment
原文件应为
PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games“
将其改为
PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.4.3/bin”
立即生效
5.测试是否安装成功
方法一:另开一个终端,输入arm-,然后按两下Tab,如果出现下列信息,则表明安装成功
arm2hpdl arm-linux-gprof
arm-elf-addr2line arm-linux-ld
arm-elf-ar arm-linux-nm
arm-elf-as arm-linux-objcopy
arm-elf-c++ arm-linux-objdump
arm-elf-c++filt arm-linux-populate
arm-elf-elf2flt arm-linux-ranlib
arm-elf-flthdr arm-linux-readelf
arm-elf-g++ arm-linux-size
arm-elf-gcc arm-linux-strings
arm-elf-ld arm-linux-strip
arm-elf-ld.real arm-none-linux-gnueabi-addr2line
arm-elf-nm arm-none-linux-gnueabi-ar
arm-elf-objcopy arm-none-linux-gnueabi-as
arm-elf-objdump arm-none-linux-gnueabi-c++
arm-elf-protoize arm-none-linux-gnueabi-cc
arm-elf-ranlib arm-none-linux-gnueabi-c++filt
arm-elf-readelf arm-none-linux-gnueabi-cpp
arm-elf-size arm-none-linux-gnueabi-ct-ng.config
arm-elf-strings arm-none-linux-gnueabi-g++
arm-elf-strip arm-none-linux-gnueabi-gcc
arm-elf-unprotoize arm-none-linux-gnueabi-gcc-4.4.3
arm-linux-addr2line arm-none-linux-gnueabi-gccbug
方法二:在终端里输入arm-linux-gcc -v
,这个命令会显示arm-linux-gcc信息和版本,如果出现以下信息则表示安装成功
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)
附录:
arm-linux-gcc-4.4.3.tar.gz
本文来自博客园,作者:登云上人间,转载请注明原文链接:https://www.cnblogs.com/lj15941314/p/16352343.html