I'm trying my hand at creating a very minimal custom Busybox/Linux distro, a task that is admittedly above my head, but I figured I'd give it a shot. My issue is that whenever I try to run a C program that is not Busybox or a Busybox utility, ash complains and tells me that the file is not found. I mounted the partition from my Arch system, installed GNU binutils and uClibc; no dice. I also wrote the simplest C program I could think of with no dependencies on any libraries:

int main(int argc, char *argv[])
    return 0;

I compiled, ran on Arch, still gave me "file not found" on my Busybox system, although it is shown when I run ls. To address the obvious, yes, I ran it from the same directory as the program and typed ./ before the file name.


My guess is that you don't have the correct dynamic linker on the Busybox system.

On your Arch system do this: ldd ./simplestprogram

I imagine ldd will give you output similar to this:

linux-vdso.so.1 =>  (0x00007fff9b34f000)
libc.so.6 => /lib64/libc.so.6 (0x0000003b19e00000
/lib64/ld-linux-x86-64.so.2 (0x0000003b19a00000)

That last line, /lib64/ld-linux-x86-64.so.2 is the dynamic linker. I bet that isn't present on your Busybox system.

I compiled a "hello, world" program on my Arch laptop, used vim in binary mode to change /lib64/ld-linux-x86-64.so.2 to /lib65/ld-linux-x86-64.so.2, saved it, and tried to execute it. I got the same "file not found" message you got.

You may not even have the libc.so file on your Busybox system. It's possible that just copying the libc.so and dynamic linker files from Arch to Busybox systems (preserving directories!) might work, but it might not. I'm just not sure.

One thing to try: install musl on your Arch machine. Compile your simple program with musl-gcc -static -o simple simple.c, move that executable, which has no dynamically-linked anything, and try it on the Busybox system.

| improve this answer | |
  • It is an embedded system. Things are built in a different way, or so I think. Is it supposed to be adding more components to it? – Rui F Ribeiro Feb 14 '16 at 9:56
  • It's not an embedded system, actually. I'm just trying to create the smallest system I reasonably can. I have no objection to adding more components if that's necessary. – Tim Feb 15 '16 at 15:41

You need to build or install a uClibc toolchain and compile/link your programs with that. You do not compile them with the standard gcc/make/....

Do I really need to build a uClibc toolchain?

| improve this answer | |
  • 1
    I cannot be of much more help here, I only used toolchains to cross-compile for NetBSD in ARM from an Intel Linux. – Rui F Ribeiro Feb 13 '16 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.