Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

busybox compilation for arm : fatal error: byteswap.h: No such file or directory

Trying to build busybox for ARM architecture

Error Faced :

> 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

Host Machine : Ubuntu 16.04 LTS

Target Platform Arch : ARM

Tool Chain Used : gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2

Busybox : busybox-1.27.2.tar.bz2

  • Setup cross Compile tool chain and export path
  • Download busybox source, configure and build

    $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

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

like image 468
xCoder Avatar asked Oct 26 '25 09:10

xCoder


1 Answers

You are using a compiler that is configured to produce bare metal executables, i.e. ones that run on a system without an operating system, to compile a program that runs on Linux. That's not going to work, at least not without a lot of extra porting effort.

You should use a cross-compiler toolchain, with headers and libraries that support your target operating system.

like image 158
followed Monica to Codidact Avatar answered Oct 29 '25 07:10

followed Monica to Codidact



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!