原文链接:linux–arm构建交叉开发环境–基于m6708-t
- 安装工具链
工具链安装包:poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.7.sh, 此安装包在光盘资料中的“\04. 软件开发指南\01. 交叉编译工具”目录下。 使用如下命令安装工具链:
$ ./poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.7.sh
此处可输入安装路径,也可回车使用默认路径
- 设置环境变量,注意“.”后面的空格
. /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
- 检查交叉编译工具是否安装成功,执行以下命令,如果正常输出未报错,表示成功。输入arm-poky 并按 Tab 键,如果能够看到很多 arm-poky-linux-gnueabi-前缀的命 令,则基本可以确定交叉编译器安装正确。
arm-poky-linux-gnueabi-gcc -v
- 编译程序。此编译器在使用时需要添加一些参数,否则会因找不到某些库或头文件而报错,具体参 数可通过查看 CC 环境变量,此外,我们可以直接使用它已经配置好的$CC 来编译程序。
$CC hello.c -o hello
- 使用 file 命令检查可执行文件格式。
$ file hello hello