Android’s NDK r7b is broken on tegra2?! – a work around

The NDK law: Every new version will break your app in a magical new way

Yesterday I finally updated to the NDK r7b for my Android builds – it worked great, until I tried a build on my Xoom.

It crashed on some silly math function with an ILL_ILLOPC error. (More info here)

The culprit is the armeabi-v7a  gnustl_static static lib – which was compiled with incorrect options making it incompatible with the tegra2.

Five different ways to work around the problem:

  1. Change -mfpu=vfpv3 to -mfpu=vfp in android-ndk-r7b\build\tools\ and (edit:  too?) and recompile it
  2. (OR) Don’t use the gnustl libs… but you sort of have to if you want exceptions and rtti.  Plus, the STLport and GAlibs have the same problem.
  3. (OR) Remove armeabi-v7a from your  Bad, will slow your app down on good devices.
  4. (OR) Copy the files from android-ndk-r7b\sources\cxx-stl\gnu-libstdc++\libs\armeabi to android-ndk-r7b\sources\cxx-stl\gnu-libstdc++\libs\armeabi-v7a – the lib won’t be as fast as it could be, but at least your app can build an armabi-v7a version
  5. (OR) Go back to ndk r7… but it has its own issues, I don’t recommend it

I was too lazy to do #1 so I did #4.  Don’t forget to clean/rebuild your project so it puts the new files in there.

EDIT: Just noticed a google tech has commented on the subject here.

2 thoughts on “Android’s NDK r7b is broken on tegra2?! – a work around

Leave a Reply

Your email address will not be published. Required fields are marked *