error LNK2001: unresolved external symbol v8::platform::NewDefaultPlatform

576 views
Skip to first unread message

Safe Online World

unread,
Feb 15, 2020, 1:43:40 AM2/15/20
to v8-users
Hello,

I'm getting linking error while trying to create
v8::platform::NewDefaultPlatform in v8 ver 8.2.77

This my v8 build command
call gn gen out.gn/library --args="is_debug=false is_component_build=true v8_use_external_startup_data=true v8_static_library=false use_custom_libcxx=false use_custom_libcxx_for_host=true v8_enable_i18n_support=false target_cpu=\"x64\""

call ninja -C out.gn/library v8.dll

Link lib(s)
v8.dll.lib
v8_libbase
.dll.lib
v8_libplatform
.dll.lib

Error Message by Visual Studio 2019
class std::unique_ptr<class v8::Platform,struct std::default_delete<class v8::Platform> > __cdecl v8::platform::NewDefaultPlatform(int,enum v8::platform::IdleTaskSupport,enum v8::platform::InProcessStackDumping,class std::unique_ptr<class v8::TracingController,struct std::default_delete<class v8::TracingController> >)" (?NewDefaultPlatform@platform@v8@@YA?AV?$unique_ptr@VPlatform@v8@@U?$default_delete@VPlatform@v8@@@std@@@std@@HW4IdleTaskSupport@12@W4InProcessStackDumping@12@V?$unique_ptr@VTracingController@v8@@U?$default_delete@VTracingController@v8@@@std@@@4@@Z)


Please help me to solve this problem.

Regards
Rajib Chy

Bill Ticehurst

unread,
Feb 19, 2020, 1:42:00 PM2/19/20
to v8-users
Seeing as you state the error message is in VS2019, I'm assuming you are trying to use these libraries once built from a Visual Studio/MSVC project?

If so, the issue may be that you are building V8 with one toolchain and standard library (i.e. clang & libc++), and trying to consume with another (i.e. MSVC and its standard library). As a simple test, can you try with "is_clang = false", and remove the "use_*libcxx*" settings and see if this works. (Is there a specific reason you have these libcxx settings?).

Note: You do have use_custom_libcxx set to false, but looking in the c++.gni file I see the below, so as you have use_custom_libxx_for_host set to true, if your current_cpu and host_cpu are the same, maybe it's still getting set to true.

use_custom_libcxx =
    use_custom_libcxx || (use_custom_libcxx_for_host && current_cpu == host_cpu)

To be honest, I'm not super familiar with the various permutations and flow of settings here through the GN build system, but I do know if you mix you C++ standard library, you're going to have a bad time trying to link across boundaries, and it seems here that v8::platform::NewDefaultPlatform exposes standard library types in its signature, so it would be good to rule that out first.

 - Bill

Safe Online World Ltd.

unread,
Feb 20, 2020, 4:51:32 AM2/20/20
to v8-users
Thanks for your kind response.

I'm not familiar with c++.gni. However, now I can embedded V8 with application.

This bellow command works

call gn gen out.gn/x64.release --args="is_debug=false use_glib=false is_component_build=true v8_use_external_startup_data=true v8_static_library=false is_clang = false v8_enable_i18n_support=false target_cpu=\"x64\""


Reply all
Reply to author
Forward
0 new messages