title: How to configure gcc to compile for android?
body: <p>I've read in the gcc documentation that it supports building android binaries with the -mandroid and -mbionic switches. First I tried it with the native gcc built from svn. Result:</p>
  
  <pre><code>dancsi@dancsi-VirtualBox:~$ gcc -v
  Using built-in specs.
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
  Target: i686-pc-linux-gnu
  Configured with: ../source/configure --enable-threads --disable-nls
  Thread model: posix
  gcc version 4.7.0 20110611 (experimental) (GCC)
  dancsi@dancsi-VirtualBox:~$ g++ test.cpp -mandroid -o test.out
  dancsi@dancsi-VirtualBox:~$ file test.out
  test.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
  </code></pre>
  
  <p>Basically, it failed. Next, I tried to compile the same gcc sources with target=arm-linux-androideabi, (without defining sysroot,...), and it passed the configuration, but failed to build saying pthread.h is not found:</p>
  
  <pre><code>In file included from ../.././gcc/gthr-default.h:1:0,
                   from ../../../combined/libgcc/../gcc/gthr.h:160,
                   from ../../../combined/libgcc/../gcc/unwind-dw2.c:37:
  ../../../combined/libgcc/../gcc/gthr-posix.h:41:21: fatal error: pthread.h: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>So, does anybody have the instructions for how to use gcc to build android binaries (I don't want to use code sourcery or android-ndk)?</p>
  
  <p>EDIT:
  my configure options</p>
  
  <pre><code>configure --target=arm-linux-android --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-libssp --disable-libgomp --disable-nls --enable-languages=c,c++,java
  </code></pre>