Android NDK, why are you using my system headers?

335 views
Skip to first unread message

ol...@illusionlabs.se

unread,
Mar 4, 2014, 3:22:59 AM3/4/14
to andro...@googlegroups.com
I'm trying to set up a huge pile of code built for another platform on
Android (runs on OSX and iOS)
I thought I had everything under control, but then this build error appeared:

[armeabi-v7a] Compile++ thumb: common <= Device.cpp
In file included from jni/src/Device.cpp:8:
In file included from /usr/include/sys/sysctl.h:83:
In file included from /usr/include/sys/ucred.h:76:
In file included from /usr/include/bsm/audit.h:338:
In file included from /usr/include/mach/port.h:91:
In file included from /usr/include/mach/boolean.h:73:
/usr/include/mach/machine/boolean.h:35:10: fatal error:
'mach/arm/boolean.h' file not found
#include "mach/arm/boolean.h"
         ^
1 error generated.
make: *** [obj/local/armeabi-v7a/objs/common/src/Device.o] Error 1

I'm building on OSX, and as you can see, it points to files in
/usr/include, that is, the headers of my OS! 
(and fails because my PC is not running arm...)

Anyone has any idea what I might have messed up?
It is not listed on the command line, so is it provided in some env variable?
I'm using the LLVM compiler, gnulibc++, and NDK r9c

sys/sysctl.h seems to not be available in Android, so I have to fix
this with a patch to my code, but the fact it tries to look in /usr/include makes
me worry it does the same for other headers too, and I will have lots
of trouble down the road because of it..

Even if this is just a side effect of it not being available in
"platforms/android-xx/arch-arm/usr/include" in the NDK, I'd rather
like it if /usr/include/ was not available at all for my NDK build...

Any ideas?

Cheers,
Olof

Duarte Peixinho

unread,
Jun 18, 2014, 9:50:56 AM6/18/14
to andro...@googlegroups.com
Did you find a solution for this?

Alex Cohn

unread,
Jul 14, 2014, 6:50:58 PM7/14/14
to andro...@googlegroups.com
I suggest that you try to run `ndk-build V=1`. You will see all the compilation flags and settings in your build log, and this can help you find out what messed up. I never had such problems on Mac nor on other platforms.

BR,
Alex Cohn
Reply all
Reply to author
Forward
0 new messages