尝试构建ARM架构的busybox
遇到错误:
> In file included from include/libbb.h:13:0,
> from include/busybox.h:8,
> from applets/applets.c:9: include/platform.h:157:11: fatal error: byteswap.h: No such file or directory # include
> <byteswap.h>
> ^~~~~~~~~~~~ compilation terminated. scripts/Makefile.build:197: recipe for target 'applets/applets.o'
> failed make[1]: *** [applets/applets.o] Error 1 Makefile:372: recipe
> for target 'applets_dir' failed make: *** [applets_dir] Error 2
主机:Ubuntu 16.04 LTS
目标平台架构:ARM
使用的工具链:gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
Busybox:busybox-1.27.2.tar.bz2
下载 busybox 源代码,配置并构建
$导出路径=$PATH:~/junk/bbb-src-bin/arm7-toolchain/gcc-arm-none-eabi-7-2017-q4-major/bin
$make ARCH-arm CROSS_COMPILE=~/junk/bbb-src-bin/arm7-toolchain/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-defconfig
$make ARCH=arm CROSS_COMPILE=~/junk/bbb-src-bin/arm7-toolchain/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi- install
您正在使用配置为生成裸机可执行文件(即在没有操作系统的系统上运行的可执行文件)的编译器来编译在 Linux 上运行的程序。这是行不通的,至少在没有大量额外的移植工作的情况下是行不通的。
您应该使用交叉编译器工具链,以及支持您的目标操作系统的标头和库。
有点晚了,不过这个问题好像还活着。
您可能想使用其他工具:
gcc-arm-linux-gnueabi 用于软件浮点支持, 或 gcc-arm-linux-gnueabihf 用于硬件浮点支持。
这些专为从 Linux @ Intel HW 到 Linux @ ARM HW 的交叉编译而设计
在 UBUNTU 上获取它们:
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install gcc-arm-linux-gnueabihf
手动下载工具链: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads 文档: https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain