简体   繁体   English

使用vanilla GCC(或Clang)和Android NDK

[英]Using vanilla GCC (or Clang) with android NDK

Android-NDK ships its own compiler to build the native code. Android-NDK附带自己的编译器来构建本机代码。 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. 我当前的android-NDK安装附带的版本是arm-linux-androideabi-g++ (GCC) 4.6.x-google 20120106 (prerelease) ,我猜它是GCC 4.6的一个分支。

What are the differences between it and a regular (vanilla) GCC 4.6? 它和普通(香草)GCC 4.6有什么区别? Is it producing better code for ARM platforms? 它是否为ARM平台生成更好的代码?

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). 我想使用其他编译器为android构建软件,如vanilla GCC 4.7或Clang,因为他们对C ++ 11有更好的支持并实现了我正在努力使用的一些功能(比如模板别名)。

  1. Is it possible to use the latest vanilla GCC or Clang, to build the native code for Android? 是否可以使用最新的香草GCC或Clang来构建Android的本机代码? What parameters should I use? 我应该使用什么参数?

  2. What are the cons of using a compiler different from the one shipped with android-SDK? 使用与android-SDK附带的编译器不同的编译器有什么缺点?

Android GCC is customized for the android as all the features in the GCC are not supported by the native Android. Android GCC是为Android定制的,因为原生Android不支持GCC中的所有功能。 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. 我不认为有可能,你可以在Android ndk google小组中发布相同内容,Google Android开发者会回答你的答案。

They were suggesting that we can make use of the cross compilers for compiling the android code with out using the android ndk. 他们建议我们可以利用交叉编译器来编译android代码而不使用android ndk。

Just a heads-up: google added clang3.1 in Revision 8c of the Android NDK. 只是一个单挑:谷歌在Android NDK的修订版8c中添加了clang3.1。 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). 它现在处于“实验性”阶段,但很容易尝试(并且可能在不久的将来会得到更好的支持,希望有一个适当的libc ++端口)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android NDK GCC似乎是铿锵的 - 它应该是这样吗? - Android NDK GCC appears to be clang - is it the way it should be? Android Studio NDK Build ninja gcc / clang命令行选项 - Android Studio NDK Build ninja gcc/clang command line options 如何在Android NDK Revision 11中切换gcc和clang? - How to switch between gcc and clang in Android NDK Revision 11? C ++ 11 cmath函数不在android NDK w / gcc-4.8或clang 3.4的std命名空间中 - C++11 cmath functions not in std namespace for android NDK w/gcc-4.8 or clang 3.4 NDK12b:clang和gcc使用独立工具链和相同的构建脚本生成的不同ELF - NDK12b: Different ELF produced by clang vs gcc using the standalone toolchain and the same build scripts 工具链“ ndk-gcc”(GNU GCC):XCode arm-linux-androideabi-gcc是Clang的包装 - Tool chain 'ndk-gcc' (GNU GCC): XCode arm-linux-androideabi-gcc is a wrapper around Clang android gradle plugin 1.4 beta ndk clang - android gradle plugin 1.4 beta ndk clang 可以将Bazel配置为在Android NDK上与Clang一起使用吗? - Can Bazel be configured to work with Clang on Android NDK? Android NDK:带有CLang错误的静态编译 - Android NDK: Static compilation with CLang error 使用ndk arm-linux-androideabi-clang ++编译器为Android构建grpc C ++ - Build grpc C++ for android using ndk arm-linux-androideabi-clang++ compiler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM