arm的busybox编译:致命错误:byteswap.h:没有这样的文件或目录

时间:2018-05-26 07:37:46

标签: arm cross-compiling embedded-linux busybox

尝试为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源码,配置和构建

    $ export PATH = $ 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 < / p>

    $ make ARCH = arm CROSS_COMPILE =〜/ junk / bbb -src-bin / arm7-toolchain / gcc-arm-none-eabi-7-2017-q4-major / bin / arm-none-eabi- install < / p>

1 个答案:

答案 0 :(得分:1)

您正在使用配置为生成裸机可执行文件的编译器,即在没有操作系统的系统上运行的可执行文件,以编译在Linux上运行的程序。这不会起作用,至少在没有大量额外移植的情况下也是如此。

您应该使用交叉编译工具链,其中包含支持目标操作系统的头文件和库。