Building embeddable version of V8 as static library with minimal binary size

838 views
Skip to first unread message

Yukkuri Shiteimasu

unread,
Mar 18, 2018, 8:07:13 AM3/18/18
to v8-users
Hi, I am trying to incorporate ES6 JavaScript engine into my small single-binary GUI application for scripting purposes and have chosen V8 as such implementation, but having hard time building minimal static library.

My flags I used in hope of creating small binary are:

--->3---
is_debug = false
target_cpu = "x64"
is_component_build = false
strip_debug_info = true
symbol_level = 0
v8_static_library = true
v8_enable_i18n_support = false
v8_use_snapshot = false
v8_enable_disassembler = false
v8_enable_gdbjit = false
v8_enable_handle_zapping = false
v8_no_inline = true
v8_monolithic = true
v8_experimental_extra_library_files = []
v8_extra_library_files = []
v8_enable_concurrent_marking = true
v8_enable_embedded_builtins = false
is_desktop_linux = false
icu_use_data_file = false
enable_iterator_debugging = false
enable_precompiled_headers = false
clang_use_chrome_plugins = false
asan_globals = false
libcpp_is_static = true
use_aura = false
use_dbus = false
use_gio = false
use_glib = false
use_icf = false
use_udev = false
--->3---

Also tried adding -Os to CFLAGS.

But resulting out.gn/x64.release/obj/libv8_base.a is about 25Mb in size even after the stripping, which is hardly can be embedded into small application (being ~25 times the application size itself).

As I read earlier in this group, some had achieved results of about ~2.5Mb[1], which is almost acceptable for my purposes, and so I wonder, what could I tune (drop, disable, exclude or otherwise, while maintaining core ES6 functionality) in order to get small static binary?

Dustin Oprea

unread,
Sep 26, 2018, 2:25:33 AM9/26/18
to v8-users
Did you ever figure this out?



Dustin

madana gopal

unread,
Jan 29, 2019, 10:26:35 AM1/29/19
to v8-users
Hi,

Able to get reduced size of v8 libs for this?. We are seeing v8_base.a size is coming around 8 MB. Please let me know, if you got any changes/config to be made to reduce size.

Thanks.

Regards,
Madan


Yongfeng liu

unread,
May 16, 2019, 5:51:14 AM5/16/19
to v8-users
needs to minimize static library size too, any guidelines?
Reply all
Reply to author
Forward
0 new messages