如何添加交叉编译工具链(toolchain)到环境变量?
Posted Dontla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何添加交叉编译工具链(toolchain)到环境变量?相关的知识,希望对你有一定的参考价值。
查看当前环境变量 echo $PATH
[root@ubuntu /home/yg/rv/sdk/rv1.8/rv1126_rv1109]1# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
添加环境变量
查找位置
/home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/bin/
然后用gedit打开/etc/bash.bashrc
,在最后一行添加
export PATH=/home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/bin/:$PATH
保存退出
然后用source命令来让它生效
source /etc/bash.bashrc
然后查看命令,可以看到已经生效了
which命令
[root@ubuntu /home/yg]2# which arm-linux-gnueabihf-gcc
/home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/bin//arm-linux-gnueabihf-gcc
type命令
[root@ubuntu /home/yg]3# type arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc 是 /home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/bin/arm-linux-gnueabihf-gcc
–version
[root@ubuntu /home/yg]4# arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
tab键
echo $PATH
[root@ubuntu /home/yg]8# echo $PATH
/home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
以上是关于如何添加交叉编译工具链(toolchain)到环境变量?的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu配置交叉编译环境(配置交叉编译工具链)配置arm-linux-gcc交叉编译工具链(添加交叉编译工具链(toolchain)到环境变量)