busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

时间:2024-04-05 18:55:50

1 软件环境

Ubuntu 12.04.1 LTS
busybox 1.21.1
arm-linux-4.4.1

2 问题描述

最近在制作linux最小系统的时候需要用到busybox软件,在编译busybox软件时报错“arm-none-linux-gnueabi-gcc: not found”。说明在编译时没有找到交叉编译工具。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

3 解决办法

ubuntu系统中没有安装交叉编译工具,因此需要安装一个。下载交叉编译工具文件arm-linux-4.4.1.tar.gz,放在linux的一个目录下,这个目录将会成为交叉编译工具的安装目录,不能随便删除了。我的存放目录是“/usr/local/arm”。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

采用shell命令:tar -xvf arm-linux-4.4.1.tar.gz 4.4.1 解压压缩包并重名为“4.4.1”。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

解压成功后,采用ls指令查看,发现arm目录下多了一个4.4.1目录,这就是刚才的解压文件目录。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

查看目录4.4.1中的内容,可知里边有一个arm-none-linux-gnueabi目录。进入之后查看内容,可知里边有一个bin目录,再进去查看,可以找到arm-none-linux-gnueabi相关的交叉编译工具可执行文件。至此已经找到交叉编译工具的存放路径:/usr/local/arm/4.4.1/arm-none-linux-gnueabi/bin

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

接下来需要配置环境变量,采用shell指令:vim /etc/profile 打开环境变量配置文件。在最后一行添加:export PATH=$PATH:/usr/local/arm/4.4.1/arm-none-linux-gnueabi/bin 保存后退出。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

执行命令:source /etc/profile使刚才修改的环境变量生效。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

验证一下是否安装成功,在shell命令行输入:arm-none-linux-gnueabi-,然后按Tab键,可以显示所有的arm-none-linux-gnueabi工具。这说明环境变量设置成功。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

在shell命令行输入:arm-none-linux-gnueabi-gcc -v,会显示交叉编译器的版本信息。如果还是提示未找到arm-none-linux-gnueabi-gcc,则可能是缺少32位的库造成的。因此Ubuntu12.04用的是64位的,相应的库也是64位的,因此缺少32位的库。采用指令:sudo apt-get install ia32-libs安装32位的库之后重新执行arm-none-linux-gnueabi-gcc -v 指令。

busybox安装出错:“arm-none-linux-gnueabi-gcc: not found”

重新对busybox进行配置,然后执行make指令成功。上边的问题解决。