Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using vanilla GCC (or Clang) with android NDK

Android-NDK ships its own compiler to build the native code. The version shipped with my current android-NDK installation is arm-linux-androideabi-g++ (GCC) 4.6.x-google 20120106 (prerelease), I guess it's a fork of GCC 4.6.

What are the differences between it and a regular (vanilla) GCC 4.6? Is it producing better code for ARM platforms?

I'd like to use other compilers to build software for android, like vanilla GCC 4.7 or Clang, since they have a better support of C++11 and implement some features I'm struggling to use (like template aliases).

  1. Is it possible to use the latest vanilla GCC or Clang, to build the native code for Android? What parameters should I use?

  2. What are the cons of using a compiler different from the one shipped with android-SDK?

like image 991
peoro Avatar asked Aug 13 '12 00:08

peoro


2 Answers

Android GCC is customized for the android as all the features in the GCC are not supported by the native Android. I dont think there is a possibility, you can post the same in the android ndk google groups where your answers will be replied by the Google Android Developers.

They were suggesting that we can make use of the cross compilers for compiling the android code with out using the android ndk.

like image 115
Suman Avatar answered Oct 05 '22 05:10

Suman


Just a heads-up: google added clang3.1 in Revision 8c of the Android NDK. It's in "experimental" stage now, but easy to try out (and probably will be better supported in the near future, hopefully with a proper port of libc++, too).

like image 43
mitchnull Avatar answered Oct 05 '22 03:10

mitchnull