v8 static library on windows gives linker errors

446 views
Skip to first unread message

Mike Moening

unread,
Oct 7, 2018, 6:37:48 PM10/7/18
to v8-users
Trying to get the latest version of V8 on windows to successfully link with my application.

I've got VC 2017 on a Windows 7 box.
I'm trying to build an x64 debug static library.
I've managed to get V8 to build but I'm running into the following linker errors:

1>v8_base_1.lib(isolate.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl v8::internal::SetupIsolateDelegate::SetupBuiltins(class v8::internal::Isolate *)" (?SetupBuiltins@SetupIsolateDelegate@internal@v8@@UEAAXPEAVIsolate@23@@Z)
1>v8_base_1.lib(isolate.obj) : error LNK2001: unresolved external symbol "public: virtual bool __cdecl v8::internal::SetupIsolateDelegate::SetupHeap(class v8::internal::Heap *)" (?SetupHeap@SetupIsolateDelegate@internal@v8@@UEAA_NPEAVHeap@23@@Z)

My args.gn file looks like this:

is_debug = true
is_clang = false
v8_target_cpu = "x64"
target_cpu = "x64"
v8_enable_backtrace = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
is_component_build = false
v8_static_library = true
use_custom_libcxx = false
use_custom_libcxx_for_host = false
treat_warnings_as_errors = false
v8_enable_i18n_support = false
v8_use_external_startup_data = false

When the V8 build is complete I end up with no less than 36 separate .lib files being generated!
Of those 36 I link with the following in my app:

v8_base_0.lib
v8_base_1.lib
v8_libbase.lib
v8_libplatform.lib
v8_initializers.lib
v8_nosnapshot.lib
v8_libsampler.lib

I've tried removing and adding different v8 lib files in the hope of getting a clean link.
No such luck.
Any ideas as to why it's producing so many output .lib files or which ones I need to successfully link?
 
Mike M.

Mike Moening

unread,
Oct 7, 2018, 6:50:42 PM10/7/18
to v8-users
Here's the build command i'm using:


Mike Moening

unread,
Oct 8, 2018, 5:03:49 PM10/8/18
to v8-users
I tried linking in the v8_init.lib file to my project.
The same error still exists but under another library?

1>v8_init.lib(setup-isolate-full.obj) : error LNK2019: unresolved external symbol "protected: static void __cdecl v8::internal::SetupIsolateDelegate::SetupBuiltinsInternal(class v8::internal::Isolate *)" (?SetupBuiltinsInternal@SetupIsolateDelegate@internal@v8@@KAXPEAVIsolate@23@@Z) referenced in function "public: virtual void __cdecl v8::internal::SetupIsolateDelegate::SetupBuiltins(class v8::internal::Isolate *)" (?SetupBuiltins@SetupIsolateDelegate@internal@v8@@UEAAXPEAVIsolate@23@@Z)

1>v8_init.lib(setup-isolate-full.obj) : error LNK2019: unresolved external symbol "protected: static bool __cdecl v8::internal::SetupIsolateDelegate::SetupHeapInternal(class v8::internal::Heap *)" (?SetupHeapInternal@SetupIsolateDelegate@internal@v8@@KA_NPEAVHeap@23@@Z) referenced in function "public: virtual bool __cdecl v8::internal::SetupIsolateDelegate::SetupHeap(class v8::internal::Heap *)" (?SetupHeap@SetupIsolateDelegate@internal@v8@@UEAA_NPEAVHeap@23@@Z)

Jakob Kummerow

unread,
Oct 8, 2018, 5:06:57 PM10/8/18
to v8-users
The set of required libraries should be:

v8_base
v8_snapshot
v8_libbase
v8_libplatform
v8_libsampler

Does that work?

As a simpler alternative, the instructions recommend to use the "v8_monolith" target, which should include everything you need in one convenient bundle.


On Sun, Oct 7, 2018 at 3:50 PM Mike Moening <mike.m...@gmail.com> wrote:
Here's the build command i'm using:


--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Moening

unread,
Oct 8, 2018, 5:14:16 PM10/8/18
to v8-users
I like the idea of a single library.
I tried the following based on the instructions I saw:

ninja -C out.gn/x64.debug v8_monolith


but got this error:


ninja: Entering directory `out.gn/x64.debug'

ninja: error: unknown target 'v8_monolith'


Mike Moening

unread,
Oct 8, 2018, 5:53:01 PM10/8/18
to v8-users
Did a little more googling and found this option for the args.gn file:

v8_monolithic = true
is_debug = true
is_clang = false
v8_target_cpu = "x64"
target_cpu = "x64"
v8_enable_backtrace = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
is_component_build = false
v8_static_library = true
use_custom_libcxx = false
use_custom_libcxx_for_host = false
treat_warnings_as_errors = false
v8_enable_i18n_support = false
v8_use_external_startup_data = false

Which is producing a single output file named: v8_monolith.lib
Which when linked with my application finally has no errors!
The v8_monolith.lib is unbelievably huge (nearly a gig) but at least it works.

Jakob Kummerow

unread,
Oct 8, 2018, 6:34:25 PM10/8/18
to v8-users
The v8_monolith.lib is unbelievably huge (nearly a gig) 

That's probably mostly debug info. Try Release mode ("is_debug = false"). 

Reply all
Reply to author
Forward
0 new messages