简体   繁体   中英

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?

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM