Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find sys/cdefs.h when building V8 for Android

I'm trying to build V8 for Android (via https://code.google.com/p/v8/wiki/D8OnAndroid):

svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
make dependencies
ANDROID_NDK_ROOT="/home/bart/software/android-ndk-r9d" make android_arm.release

However, the last command fails:

make[1]: Entering directory `/home/bart/Desktop/v8'
make[2]: Entering directory `/home/bart/Desktop/v8/out'
  AR(target) /home/bart/Desktop/v8/out/android_arm.release/obj.target/tools/gyp/libv8_base.arm.a
  CXX(host) /home/bart/Desktop/v8/out/android_arm.release/obj.host/v8_base.arm/src/accessors.o
In file included from /usr/include/stdio.h:27:0,
                 from ../src/../include/v8stdint.h:11,
                 from ../src/../include/v8.h:18,
                 from ../src/v8.h:29,
                 from ../src/accessors.cc:5:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
 #  include <sys/cdefs.h>
                         ^
compilation terminated.
make[2]: *** [/home/bart/Desktop/v8/out/android_arm.release/obj.host/v8_base.arm/src/accessors.o] Error 1
make[2]: Leaving directory `/home/bart/Desktop/v8/out'
make[1]: *** [android_arm.release] Error 2
make[1]: Leaving directory `/home/bart/Desktop/v8'
make: *** [android_arm.release] Error 2

The missing file, sys/cdefs.h. exists in NDK/platforms/*/arch-arm/usr/include, but apparently the compiler can't find it. Am I missing a step?

Update: Upon closer examination it looks like the compiler is reading /usr/include/features.h from my host system (i.e. Linux). This seems inappropriate, so yeah, am I missing a step that should point the process to NDK/platforms/*/arch-arm?

I'm using NDK 9d (Linux x86_64)

like image 907
Bart van Heukelom Avatar asked Dec 19 '22 14:12

Bart van Heukelom


1 Answers

After some more digging, I found that V8's build process has both a target and host step. I simply had to install the missing files on my host system (apt-get install libc6-dev-i386 g++-multilib), after which the compilation succeeded.

Now, I still don't understand why anything from the host is needed, but I'll accept this victory nonetheless.

like image 159
Bart van Heukelom Avatar answered Apr 07 '23 04:04

Bart van Heukelom