标签:文件结构 exp 环境变量 sudo home pre snap toc gcc
title: 更换gcc工具链
date: 2019/1/16 19:27:51
toc: true
---
下载后解压到一个临时目录先看看文件结构
mkdir tmp
tar xjf arm-linux-gcc-4.3.2.tar.bz2 -C tmp/
查看文件结构,可以看到arm-linux-gcc
这个工具位置在bin
下
cd tmp/usr/local/arm/4.3.2/
book@100ask:~/stu/gcc/tmp/usr/local/arm/4.3.2$ ls
arm-none-linux-gnueabi bin lib libexec share
book@100ask:~/stu/gcc/tmp/usr/local/arm/4.3.2$ ls bin/
arm-linux-addr2line arm-linux-objdump arm-none-linux-gnueabi-gcov
arm-linux-ar arm-linux-ranlib arm-none-linux-gnueabi-gdb
arm-linux-as arm-linux-readelf arm-none-linux-gnueabi-gdbtui
arm-linux-c++ arm-linux-size arm-none-linux-gnueabi-gprof
arm-linux-c++filt arm-linux-sprite arm-none-linux-gnueabi-ld
arm-linux-cpp arm-linux-strings arm-none-linux-gnueabi-nm
arm-linux-g++ arm-linux-strip arm-none-linux-gnueabi-objcopy
arm-linux-gcc arm-none-linux-gnueabi-addr2line arm-none-linux-gnueabi-objdump
arm-linux-gcc-4.3.2 arm-none-linux-gnueabi-ar arm-none-linux-gnueabi-ranlib
arm-linux-gcov arm-none-linux-gnueabi-as arm-none-linux-gnueabi-readelf
arm-linux-gdb arm-none-linux-gnueabi-c++ arm-none-linux-gnueabi-size
arm-linux-gdbtui arm-none-linux-gnueabi-c++filt arm-none-linux-gnueabi-sprite
arm-linux-gprof arm-none-linux-gnueabi-cpp arm-none-linux-gnueabi-strings
arm-linux-ld arm-none-linux-gnueabi-g++ arm-none-linux-gnueabi-strip
arm-linux-nm arm-none-linux-gnueabi-gcc
arm-linux-objcopy arm-none-linux-gnueabi-gcc-4.3.2
解压到根目录
sudo tar xjf arm-linux-gcc-4.3.2.tar.bz2 -C /
book@100ask:/usr/local/arm/4.3.2/bin$ ls /usr/local/arm/4.3.2/bin/arm-linux-gcc -l
-rwxr-xr-x 1 root root 62 3月 25 2009 /usr/local/arm/4.3.2/bin/arm-linux-gcc
查看下原来的环境变量
echo $PATH
/home/book/bin:/home/book/.local/bin:/opt/slickedit-pro2017/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/gcc-3.4.5-glibc-2.3.6/bin:/snap/bin
查看下原来的gcc的位置
book@100ask:/usr/local/arm/4.3.2/bin$ which arm-linux-gcc
/opt/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
添加环境变量/usr/local/arm/4.3.2/bin/
,使用:
分开
export PATH=/home/book/bin:/home/book/.local/bin:/opt/slickedit-pro2017/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/arm/4.3.2/bin/
上述使用export PATH=xxx
是临时的,如果需要永久的话,ubuntu
下使用
sudo vi /etc/environment
source /etc/environment
看下新版本
arm-linux-gcc -v
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
标签:文件结构 exp 环境变量 sudo home pre snap toc gcc
原文地址:https://www.cnblogs.com/zongzi10010/p/10331602.html