Issue with system() call when cross compiling for Android-Collection of common programming errors

Based on some limitations with the NDK standalone toolchain and bionic, I have rolled my own toolchain using crosstool-NG with these general settings:

  • binutils-2.22
  • gcc-4.5.3 with gfortran enabled
  • glibc-2.14.1
  • kernel-headers-2.35.7
  • arch arm4t

Using this I build an executable and upload all dependencies, including libc, ld-linux etc with it onto my Android device. I manually run the executable with ld-linux.so.3 –library-path …

It is a very complex executable, and it all seems to work except, if I do any system() call, even something basic, like system(“pwd”) or system(NULL) I get 127 as the status (not found). If I go further and use popen instead to collect a response, I get:

*glibc detected * double free or corruption

What is going on? Has anyone succeeded at doing similar? Is there a permissions issue? Is there something fundamentally different about Android that makes system() calls not possible? Where can I find out how bionic handles system and popen (source code) in the end, because I think if you use the NDK you can do system() calls.