Missing libv8_libplatform.cr.so in Android build

51 views
Skip to first unread message

Tommaso Bossi

unread,
Jun 13, 2020, 5:29:01 AM6/13/20
to v8-users
Hi everyone,

I'm trying to compile V8 as a shared library for all platforms. The compilation seems to be successful, however, when I try to link it in my project I have problems with the Android versions.
Specifically, among the binaries generated for android, libv8_libplatform.cr.so is missing and consequently I get:
error: undefined reference to 'v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__ndk1::unique_ptr<v8::TracingController, std::__ndk1::default_delete<v8::TracingController> >)'
when I try to build my library for Android.

Here's how I compile the linux version:
python ./tools/dev/v8gen.py x64.release -vv -- '
target_os = "linux"
is_component_build = true
v8_enable_i18n_support = false
symbol_level = 1
'

ninja
-C out.gn/x64.release -t clean
ninja
-C out.gn/x64.release v8
then I take all *.so files in out.gn/x64.release folder:
  • libc++.so
  • libchrome_zlib.so
  • libv8.so
  • libv8_libbase.so
  • libv8_libplatform.so

Here's how I compile the Android versions (arm64 in this example):
python ./tools/dev/v8gen.py arm64.release -vv -- '
target_os = "android"
target_cpu = "arm64"
v8_target_cpu = "arm64"
is_component_build = true
v8_enable_i18n_support = false
symbol_level = 1
'

ninja
-C out.gn/arm64.release -t clean
ninja
-C out.gn/arm64.release v8
then I take all *.so files in out.gn/arm64.release folder:
As you can see there is no libv8_libplatform.cr.so in this case.
However, I noticed the presence of the clang_x64_v8_arm64 folder which contains libc++.cr.so, libchrome_zlib.cr.so, libv8_libbase.cr.so, and libv8_libplatform.cr.so but no libv8.cr.so.

So now I'm not sure which are the right binaries to use.
Am I using the wrong settings? If not, why is the out.gn folder structure different for Android builds? and which binaries should I take?

Thanks a lot in advance.

PS: I'm using V8 8.3.110.9

Tommaso Bossi

unread,
Jun 15, 2020, 11:31:40 AM6/15/20
to v8-users
Actually I don't think the issue is related to this specific version. I have tried with version 8.1 and I get the same result.

Elmi Ahmadov

unread,
Jun 15, 2020, 11:39:29 AM6/15/20
to v8-users
I don't know your exact use case but with `symbol_level = 0`, it works for me on V8 8.3.110.9

Tommaso Bossi

unread,
Jun 16, 2020, 1:20:40 PM6/16/20
to v8-users
Thanks, but it didn't work.

Anyway I managed to build the missing piece by running:
ninja -C out.gn/arm64.release v8_libplatform
ninja
-C out.gn/arm64.release v8

I have not yet understood why android build behaves differently from the others, though.

Elmi Ahmadov

unread,
Jun 16, 2020, 1:26:41 PM6/16/20
to v8-users
This is the complete gn args that I use to build V8 8.3.110.9 for Android:

target_os = "android"
target_cpu
= "arm64"
v8_target_cpu
= "arm64"

is_component_build
= false
is_debug
= false
use_custom_libcxx
= false
v8_monolithic
= true
v8_use_external_startup_data
= false
v8_enable_i18n_support
= false
symbol_level
= 0
v8_android_log_stdout
= true
v8_enable_pointer_compression
= false

I build the monolithic library then use on Android, just set "v8_monolithic" to "false" if you don't want to use the monolithic library. Hope this will help
Reply all
Reply to author
Forward
0 new messages