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

arm的busybox编译:致命错误:byteswap.h:没有这样的文件或目录,arm,cross-compiling,embedded-linux,busybox,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 #

尝试为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
>在include/libbb.h:13:0中包含的文件中,
>从include/busybox.h:8,
>来自applets/applets.c:9:include/platform.h:157:11:致命错误:byteswap.h:没有这样的文件或目录#include
> 
>^~~~~~~~~~~~~~~编译已终止。scripts/Makefile.build:197:recipe for target'applets/applets.o'
>制作失败[1]:***[applets/applets.o]错误1制作文件:372:配方
>对于目标“applets\u dir”,生成失败:**[applets\u dir]错误2
主机:Ubuntu 16.04 LTS

目标平台拱:手臂

使用的工具链

Busybox

  • 设置交叉编译工具链和导出路径
  • 下载busybox源代码,配置并构建

    $export PATH=$PATH:~/junk/bbb src bin/arm7工具链/gcc-arm-none-eabi-7-2017-q4-major/bin

    $make ARCH arm CROSS_COMPILE=~/junk/bbb src bin/arm7工具链/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-defconfig

    $make ARCH=arm CROSS\u COMPILE=~/junk/bbb src bin/arm7工具链/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-安装


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


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

这对我很有用。正如您所建议的,我安装了arm交叉编译器工具链Ubuntu 16.04$sudo apt get update$sudo apt get install libncurse5 dev$sudo apt get install gcc make gcc arm linux gnueabi$sudo apt get install binutils arm linux gnueabi