方式1:在~/.brshrc中添加
1.解压交叉编译工具
ubuntu@ubuntu-ubuntu:/opt/arm/toolchain$ tar -zxvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.gz
2.在~/.bashrc最后面中添加路径
ubuntu@ubuntu-ubuntu: sudo vim ~/.bashrc
export PATH=$PATH:/opt/arm/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin
3.重启终端
4.检查编译器能否正常使用
ubuntu@ubuntu-ubuntu:aarch64-rockchip1031-linux-gnu-gcc -v
.....
Supported LTO compression algorithms: zlib
gcc version 10.3.1 20210621 (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29))
方式2:修改/etc/profile文件
1.解压交叉编译器后在/etc/profile文末添加编译器路径
ubuntu@ubuntu-ubuntu:sudo vi /etc/profile
export PATH=$PATH:/opt/arm/toolchain/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin
2.更新配置环境
ubuntu@ubuntu-ubuntu:source /etc/profile
3.检查编译器能否正常使用
ubuntu@ubuntu-ubuntu:aarch64-rockchip1031-linux-gnu-gcc -v
.....
Supported LTO compression algorithms: zlib
gcc version 10.3.1 20210621 (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29))