Notes on Compiling Various C Libraries for the Android NDK

It’s not so easy! You can’t just use the “./configure and make” build system most libraries come with. Instead, at the very least you’re going to have to create your own custom “Android.mk”, which lists the .c files you need and sets up gcc correctly.

Well, that’s the best-case scenario. Some libraries require some minimal patching or other trickery. Here are my notes for some.

SDL 2.0.3

SDL_mixer 2.0.0

libogg 1.3.1

libpng 1.6.9

Pixman 0.32.4

ifeq ($(TARGET_ARCH),x86)
#if defined(USE_ARM_SIMD) || defined(USE_ARM_NEON) || defined(USE_ARM_IWMMXT)
    imp = _pixman_arm_get_implementations (imp);
    imp = _pixman_x86_get_implementations (imp);
    //imp = _pixman_ppc_get_implementations (imp);
    //imp = _pixman_mips_get_implementations (imp);

Cairo 1.12.16

#ifndef __ANDROID__
struct lconv *locale_data;
#ifndef __ANDROID__
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point = ".";

(I’ve opened a bug about this.)

Lua 5.2.3

#ifdef __ANDROID__
#define getlocaledecpoint() ('.')

See also this Stack Overflow post.

exceptions4c 3.0.0

SimCList 1.6

Dec 31, 1969, 18:00 CST