Solving NDK build issues on OS X


So my OUYA arrived today, and of course I couldn’t resist to try and build some stuff myself. When building Mupen64Plus AE (a Nintendo64 emulator), the following build error message didn’t seem to want to go away:

In file included from /usr/include/sys/_types.h:33:0,
                 from /usr/include/_types.h:27,
                 from /usr/include/stdlib.h:63,
                 from jni/core/projects/android/../../src/api/callbacks.c:26:
/usr/include/machine/_types.h:34:24: fatal error: arm/_types.h: No such file or directory
compilation terminated.

This was caused by the fact that, for some reason, the project I was building added

-I$(SYSROOT)/usr/include/

as a compilation flag, and since I didn’t have a $SYSROOT environment variable set, that resulted in /usr/include being included. My system header files then conflicted with the NDK header files. My quick workaround was this:

SYSROOT="foo" ndk-build

And voilá, a little “foo” solved the problem perfectly :D