How to build v8 arm for android on ubuntu

153 views
Skip to first unread message

lvfulo...@gmail.com

unread,
Jan 11, 2017, 10:39:52 PM1/11/17
to v8-users

I build follow the doc.

1.) Install Git

2.) Install depot_tools

3.) Update depot_tools by executing the following into your terminal/shell:

gclient

4.) Go into the directory where you want to download the V8 source into and execute the following in your terminal/shell:

fetch v8
cd v8

5.) Make sure that you are in the V8 source directory. If you followed every step up until step 4.) you already should be at the right location.

6.) Download all the build dependencies by executing the following in your terminal/shell:

gclient sync

7.) Generate the necessary build files by executing the following in your terminal/shell:

gn gen out.gn\myandroid --args='is_debug = false target_cpu = "arm" v8_target_cpu = "arm" target_os="android" is_component_build = false v8_use_snapshot = false v8_enable_i18n_support = false'

8.) Compile the source by executing the following in your terminal/shell:

ninja -C out.gn/myandroid.release

Build success with no error.but only output libv8_libplatform.a and libv8_libbase.a.The other target is nothing.


What does "clang_x86_v8_arm" mean?? android emulator?? 

How to build v8 arm for android on ubuntu?


hasret...@gmail.com

unread,
Apr 19, 2017, 6:54:22 AM4/19/17
to v8-users
ninja -C out.gn/myandroid.release d8. Then you push to your device using adb. The guide is here

12 Ocak 2017 Perşembe 05:39:52 UTC+2 tarihinde lvfulo...@gmail.com yazdı:

ibon tolosana

unread,
Apr 23, 2017, 9:04:59 AM4/23/17
to v8-users
after compilation, you only get two thin libraries. You must create fat libraries from compiled sources. This is what i do:

cd out.gn/myandroid/obj  // or where you compiled v8 as a result of the ninja call.
mkdir libs
cd libs
ar -rcsD libv8_base.a ../v8_base/*.o
ar -rcsD libv8_libbase.a ../v8_libbase/*.o
ar -rcsD libv8_libsampler.a ../v8_libsampler/*.o
ar -rcsD libv8_libplatform.a ../v8_libplatform/*.o
ar -rcsD libv8_nosnapshot.a ../v8_nosnapshot/*.o
ar -rcsD libv8_snapshot.a ../v8_snapshot/*.o
ar -rcsD libv8_external_snapshot.a ../v8_external_snapshot/*.o

this will generate fat libraries that can be used for android compilation. You can use ar or llvm-ar from v8 thirdparty folder.
Also, the inspector library is not added, but you should follow the same procedure to get it. Get object files from src/inspector/inspector.
After this, you must successfully configure android's android.mk file with the correct libraries order, etc. Also make sure to use the same ndk version to compile v8 as to compile you android app. Here's is a short guide I wrote some time ago: https://medium.com/@hyperandroid/android-v8-embedding-guide-f64173f7958b
I recommend you use the snapshot library versions which make v8 initialize much faster, but you might have to do more work on the client side.
Hope this helps.
Reply all
Reply to author
Forward
0 new messages