How I Compiled the First Fresh BusyBox 1.36.1 Android Binaries Since 2018 Using NDK r25c If you’ve used any BusyBox app on Android in the last several years, you’ve been running the same binaries compiled in November 2018 — BusyBox v1.29.3, built by osm0sis. Not because nobody cared, but because the barrier to recompiling them cleanly for Android was high enough that nobody bothered. The NDK had moved on, toolchains changed, and the existing build documentation was years out of date. I decided to fix that for ObsidianBox Modern, my root toolbox app on the Play Store. Here’s exactly how I did it and every problem I hit along the way. What you need: Linux environment ( i used mx-linux) Android NDK r25c (download directly from google) “” https://dl.google.com/android/repository/android-ndk-r25c-linux.zip “” BusyBox 1.36.1 source: https://busybox.net/downloads/busybox-1.36.1.tar.bz2 https://busybox.net/downloads/busybox-1.36.1.tar.bz2.sha256 osm0sis’s android busybox NDK config as a base, https://github.com/osm0sis/android-busybox-ndk Build dependancies. sudo apt install build-essential libssl-dev bc git wget curl -y Extract NDK and BusyBox source, clone osm0sis’s repo for the base config. cd ~/busybox-build unzip android-ndk-r25c-linux.zip tar xf busybox-1.36.1.tar.bz2 git clone https://github.com/osm0sis/android-busybox-ndk copy osm0sis’s config into the busybox source as your starting point, cp android-busybox-ndk/configs/android-ndk.config busybox-1.36.1/.config cd busybox-1.36.1 make oldconfig you have to do this for each of the architectures by setting CROSS_COMPILE to the appropriate NDK r25c clang toolchain. make clean && make oldconfig && make -j$(nproc) target architectures: aarch64-linux-android33 - arm64-v8a, armv7a-linux-androidebi21 armeabi-v7a, x86_64-linux-android33 x86_64, i686-linux-android21 x86 here’s the problems i ran into so yes I ask AI slop to help me accomplish this the binary doesnt care wether your human or AI. Every Problem I Hit and How I Fixed It This is the part nobody documents. Here are the 7 patches required to get a clean build across all 4 architectures with NDK r25c: 1. NDK r25c ships lld only — no bfd linker The osm0sis config references `-fuse-ld=bfd` but NDK r25c dropped bfd entirely. Fix: ``` Change: -fuse-ld=bfd To: -fuse-ld=lld ``` In `.config`, find `CONFIG_EXTRA_LDFLAGS` and update accordingly. 2. strchrnul duplicate symbol at link NDK r25c’s `libc.a` always exports `strchrnul` even at API 21, causing a duplicate symbol error. Fix — add to `.config`: ``` - And in libbb/platform.c , guard the BusyBox definition: #if !defined(ANDROID) // existing strchrnul implementation #endif getsid/sethostname/adjtimex conflicts in missing_syscalls.c NDK r25c Bionic provides these at API 21, but BusyBox also tries to define them. Fix in libbb/missing_syscalls.c #if ANDROID_API < 21 // guard getsid, sethostname, adjtimex here #endif // pivot_root is never in Bionic, leave it unguarded x86 register exhaustion in TLS code, Clang with i686 target exhausts registers on BusyBox’s x86-32 ASM path in the TLS implementation. Fix in networking/tls.h // Change: #if defined(i386) // To: #if defined(i386) && !defined(clang) Same register exhaustion in tls_sp_c32.c Four separate i386 ASM guards in networking/tls_sp_c32.c need the same clang exclusion #if defined(i386) && !defined(clang) ``` Apply to all 4 affected blocks. 6. ether_arp redefinition in zcip.c NDK r25c redefines `ether_arp` from `<netinet/ether.h>`, conflicting with BusyBox’s definition. Easiest fix — disable the applet entirely in `.config`: ``` CONFIG_ZCIP=n ``` zcip is a zero-configuration IP protocol applet that has no practical use on Android anyway. 7. Final config verification Make sure these are set in `.config` before building: ``` CONFIG_STATIC=y CONFIG_CROSS_COMPILER_PREFIX=“[your NDK toolchain path]” CONFIG_EXTRA_CFLAGS=“-DHAVE_STRCHRNUL” CONFIG_ZCIP=n submitted by /u/Fair_Economist_5369
Originally posted by u/Fair_Economist_5369 on r/ClaudeCode
