Environment:
- MacBook Pro (Retina, 15-inch, Mid 2014)
- OSX Yosemite (10.10.4)
- Xcode 6.4
- Android Studio 1.3 RC 1 (141.2071668)
My intent is to compile V8 as a shared library so I can include it in my new project as a standalone Javascript engine.
These are the steps I followed starting July 16, 2015 in order to accomplish that task:
1) Used SourceTree to clone depot_tools into ~/Projects/depot_tools
2) Started Terminal, then:
export PATH=~/Projects/depot_tools:$PATH
cd Projects
fetch v8 (took about 15 min.)
target_os = [‘android’]
And then, on Terminal:
cd v8
gclient sync —nohooks (15:20 hrs - very slow connection)
4) Terminal again, then:
make android_arm -j16 library=shared
The process aborts with the following errors:
make[1]: *** No rule to make target ‘android_arm.optdebug’. Stop.
/bin/sh: ~/Projects/v8/third_party/android_tools/ndk//toolchains/arm-linux-androideabi-4.9/prebuilt/mac-x86_64/bin/*-gcc: No such file or directory
make[1]: *** [out/Makefile.android_arm.debug] Error 1
make[1]: *** [out/Makefile.android_arm.release] Error 1
No idea what is “optdebug”, so I didn’t pursue any further. The missing folder, however, was really missing. There was no prebuilt/mac-x86_64/, just one prebuilt/linux-x86_64/. Renamed the latter to the former, and then tried again.
The new error message is:
/bin/sh: ~/Projects/v8/third_party/android_tools/ndk//toolchains/arm-linux-androideabi-4.9/prebuilt/mac-x86_64/bin/arm-linux-androideabi-gcc: cannot execute binary file
Renamed directories to what they were before (that is, prebuilt/mac-x86_64/ -> prebuilt/linux-x86_64 ).
Checked my Android Studio NDK folder in ~/Library/Android/sdk/ndk-bundle, found folder prebuilt/darwin-x86_64. Copied it to V8’s /prebuilt folder, renamed it to mac-x86-64. Tried again.
The compile step failed with these errors:
In file included from .././src/libplatform/task-queue.h:8:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/queue:169:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/deque:159:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__split_buffer:7:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/algorithm:626:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/cstring:61:10: fatal error:
'string.h' file not found
#include <string.h>
^
In file included from .././src/libplatform/worker-thread.h:8:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/queue:169:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/deque:159:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__split_buffer:7:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/algorithm:626:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/cstring:61:10: fatal error:
'string.h' file not found
#include <string.h>
^
In file included from ../src/base/
bits.cc:5:
In file included from .././src/base/bits.h:9:
In file included from .././src/base/macros.h:11:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/cstring:61:10: fatal error:
'string.h' file not found
#include <string.h>
^
../src/base/atomicops_internals_x86_gcc.cc:8:10: fatal error: 'string.h' file
not found
#include <string.h>
^
1 error generated.
make[2]: *** [~/Projects/v8/out/android_arm.debug/obj.host/v8_libbase/src/base/atomicops_internals_x86_gcc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CXX(host) ~/Projects/v8/out/android_arm.debug/obj.host/v8_libbase/src/base/division-by-constant.o
In file included from ../src/base/
cpu.cc:5:
In file included from .././src/base/cpu.h:16:
In file included from .././src/base/macros.h:11:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/cstring:61:10: fatal error:
'string.h' file not found
#include <string.h>
^
In file included from .././src/libplatform/default-platform.h:8:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/functional:477:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/memory:606:
In file included from ~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/iterator:346:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/iosfwd:90:10: fatal error:
'wchar.h' file not found
#include <wchar.h> // for mbstate_t
^
In file included from .././src/base/logging.h:8:
~/Projects/v8/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/cstring:61:10: fatal error:
'string.h' file not found
#include <string.h>
^
1 error generated.
At this point, I don’t know what else to do.
Can you please tell me what am I doing wrong, and how to fix it? Being able to include V8 as a standalone Javascript engine is vital for my project, so any help will be greatly appreciated. Thanks in advance!