v8.dev icon indicating copy to clipboard operation
v8.dev copied to clipboard

Instructions Android build for ARM Processor

Open ackava opened this issue 5 years ago • 3 comments

Instructions of Android Build for ARM Processor are missing.

As per this page, https://v8.dev/docs/embed

g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -Lout.gn/arm.release/obj/ -pthread -std=c++0x

Gives error, "error adding symbols: File in wrong format" , (Relocations in generic ELF)

Same command works successfully for x64 build.

Here is what I did,

  1. tools/dev/v8gen.py arm.release
  2. Modify args.gn to
android_unstripped_runtime_outputs = false
is_debug = false
target_cpu = "arm"
target_os = "android"
v8_android_log_stdout = true
v8_target_cpu = "arm"
v8_enable_inspector = true
v8_use_snapshot = false
v8_static_library = true
is_component_build = false
use_custom_libcxx = false
v8_monolithic = true
v8_use_external_startup_data = false
enable_goma = false
  1. ninja -C out.gn/arm.release
  2. g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -Lout.gn/arm.release/obj/ -pthread -std=c++0x

ackava avatar Mar 21 '20 11:03 ackava

Hi @ackava !

Just to double check, on step 4:

g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -Lout.gn/arm.release/obj/ -pthread -std=c++0x

Is this running on your x64 host using the default g++? If so, it should only be able to target x86 code, do you need to use a cross-compiler instead? Off the top of my head, I think for android it should be something like arm-linux-androideabi-g++.

planglois avatar Apr 03 '20 12:04 planglois

Was this fixed by https://github.com/v8/v8.dev/pull/365?

RReverser avatar Apr 03 '20 20:04 RReverser

Oh no, that PR was only updating debug-arm.md. I'm not familiar with embedding V8 in an Android app, I'm not sure I can help much here :-/.

planglois avatar Apr 07 '20 09:04 planglois