1、把交叉编译器解压到/opt目录
sudo tar -zxvf Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux.tar.gz -C /opt
2、判断交叉编译器是否能给使用?
由于交叉编译器是32bit,而系统是64bit,缺少32bit的支持库
安装32bit的支持库
sudo apt install lib32z1 lib32tinfo5 lib32ncurses5
(deepin系统官方库不支持上面的,换源)
vim /etc/apt/sources.list
### 华为源:
deb [trusted=yes] https://mirrors.huaweicloud.com/deepin stable main contrib non-free
#deb-src deb https://mirrors.huaweicloud.com/deepin stable main
然后素质二连sudo apt-get update&&sudo apt-get upgrade
3、修改PATH:
修改方法:export命令。
export PATH=/opt/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin:$PATH
也可以在.c 文件的路径直接
/opt/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin/arm-linux-gcc study.c -o test
4、编译
arm-linux-gcc study.c -o study