"No such file or directory" trying to execute linux binary on Android device

user1847129 picture user1847129 · Nov 27, 2012 · Viewed 14.6k times · Source

I built a native linux ARM binary using the Android GCC toolchain (plain linux, no android or NDK).

I connected, from my PC, via adb shell, to a tablet running Android 4. I "adb push"'ed that binary into /system/bin on that device, hoping I would get it to execute there. I marked it executable with chmod 777.

If I try to execute it, I would get "No such file or directory".

Further info: The little program uses fc and fm libs. Since the ARM toolchain does not appear to have crt1, which, from an example I found, normally contains the startup code, we searched through files containing it in the android build, found crtbegin_dynamic and crtend_dynamic, but for _static equivalent, one of the pair was missing, so I did not pass -static to GCC. It was built with "-nostdlib".

What could be the problem(s)?

Answer

EthanL picture EthanL · Jan 13, 2013

If you are working on a 64-bit platform like Ubuntu 64, then this tip may help you solve the issue. Just try to get the i386 32-bit compatibility libraries installed simply with apt-get:

sudo apt-get install ia32-libs

It worked great for me. Let me know if you are stuck in same trouble.

For Ubuntu 13.10 or greater

As aditya said in the comments to this answer:

As of Ubuntu 13.10, one has to run this now: sudo apt-get install lib32z1, you may need to get the C++ stdlibs too, with this: sudo apt-get install lib32ncurses5 lib32stdc++6