NDK Tips

About NDK Tips

Show all logs when compiling

If you want to see build process when using ndk-build
Type from console(project top)

ndk-build V=1

What’s difference between ARM and Thumb mode

NDK has compile mode to compile

Mode Description ARM 32bit CPU Thumb 16bit CPU

By default, compiler mode is Thumb.

How to switch

Android.mk supports library base setting and source code base setting.

Libarary base

Add LOCAL_ARM_MODE as option

LOCAL_ARM_MODE := arm
Source code base

If you want set this mode each file, add .arm index after file name

LOCAL_SRC_FILES := \
	arm.c.arm \
	noarm.c \

In this case, arm.c is ARM mode, noarm.c is Thumb mode

What’s difference(Compile level)

Compile option is a bit different.
Different compiler options are following.

ARM, these parameters can be passed:

  • -funswitch-loops
  • -finline-limit=300
  • -O2

THUMB, these parameters should be passed:

  • -finline-limit=64
  • -Os

Debug Symbol

When you strip debug symbol from your shared library.
We need to put debug symbol under /obj/local/armeabi


Error

Unable to detect application ABI’s

Eclpse NDK path is not correctly.
Please fill it in.
“Eclipse” -> “Preferences” -> “Android” ~> “NDK”


To Debug NDK and SDK

To attach process. SDK is Java VM Debug, NDK is gdb debug.
Attach proccess debug way is in here
But cannot test MainActivity onCreate