Unreal.js icon indicating copy to clipboard operation
Unreal.js copied to clipboard

How to build v8 to work with this project?

Open Zeblote opened this issue 8 years ago • 17 comments

How are you creating the v8 binaries? I tried pretty much every combination of common settings in the args.gn file:

image

But there are 2 problems:

  • you have 4 v8_base_x.lib files for some reason, I only get a single v8_base.lib
  • attempting to replace your libs with the new ones results in a large number of errors like v8_base.lib(api.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in SharedPCH.UnrealEd.h.obj when building the plugin.

Zeblote avatar Aug 25 '17 02:08 Zeblote

Have you read this? Https://github.com/ncsoft/Unreal.js/wiki/V8 :)

crocuis avatar Aug 25 '17 11:08 crocuis

Oh! That's for building with gyp though, v8 wants to build with this new gn thing now... I'll see if it has similar options

Zeblote avatar Aug 25 '17 12:08 Zeblote

I tried using similar gn settings, but it's not successful so far. The setting v8_enable_inspector doesn't actually exist in gyp or gn.

is_debug = false
target_cpu = "x64"
v8_use_snapshot = false
v8_static_library = true
is_component_build = true
v8_enable_i18n_support = false
treat_warnings_as_errors = false

The lib is huge now! v8_base.lib is over 800MB... can't be right. Still causes hundreds of errors also: image

Zeblote avatar Aug 25 '17 13:08 Zeblote

Next try:

is_debug = false
target_cpu = "x64"
v8_use_snapshot = false
v8_static_library = true
is_component_build = false
v8_enable_i18n_support = false
treat_warnings_as_errors = false

I also to v8/build/config/win/BUILD.gn and changed configs = [ ":static_crt" ] to configs = [ ":dynamic_crt" ] since the force_dynamic_crt setting doesn't exist anymore in gn.

The v8_base.lib is back to normal size now... 350MB It also generated significantly less errors: image ... but it still isn't working.

Zeblote avatar Aug 25 '17 13:08 Zeblote

Is this the same problem? Https://bugs.chromium.org/p/v8/issues/detail?id=6461

crocuis avatar Aug 25 '17 13:08 crocuis

I don't think it is, building v8 works fine. The problem only appears when trying to link it in your plugin.

Zeblote avatar Aug 25 '17 13:08 Zeblote

I did not have a problem with gyp build. I will reply after I try to build with gn.

crocuis avatar Aug 25 '17 13:08 crocuis

I think the version of v8 you built seems to be higher than 6.0. Version 6.0 or later requires additional v8_builtins_setup.lib and v8_builtins_generators.lib.

crocuis avatar Aug 26 '17 11:08 crocuis

Oh. I've added these 2 libs for 6.0, but it's still not linking properly. Now the number of errors is down to 2 though:

2>Module.V8.cpp.obj : error LNK2019: unresolved external symbol "public: static class std::unique_ptr<class v8_inspector::V8Inspector,struct std::default_delete<class v8_inspector::V8Inspector> > __cdecl v8_inspector::V8Inspector::create(class v8::Isolate *,class v8_inspector::V8InspectorClient *)" (?create@V8Inspector@v8_inspector@@SA?AV?$unique_ptr@VV8Inspector@v8_inspector@@U?$default_delete@VV8Inspector@v8_inspector@@@std@@@std@@PEAVIsolate@v8@@PEAVV8InspectorClient@2@@Z) referenced in function "public: __cdecl FInspector::FInspector(class v8::Platform *,int,class v8::Local<class v8::Context>)" (??0FInspector@@QEAA@PEAVPlatform@v8@@HV?$Local@VContext@v8@@@2@@Z)
2>v8_libbase.lib(stack_trace_win.obj) : error LNK2019: unresolved external symbol __imp_PathRemoveFileSpecW referenced in function "bool __cdecl v8::base::debug::`anonymous namespace'::InitializeSymbols(void)" (?InitializeSymbols@?A0x76313174@debug@base@v8@@YA_NXZ)

How does your args.gn file look? Or did you change something else to make it work?

Zeblote avatar Aug 26 '17 12:08 Zeblote

No. I found out that I was experiencing the same thing as your error when building v8 version 6.1 with GYP instead of GN. Assuming your error message, I think v8_enable_inspector is missing.

crocuis avatar Aug 26 '17 14:08 crocuis

I searched the entire v8 folder for enable_inspector and the setting doesn't exist. Maybe it has been renamed.

Zeblote avatar Aug 26 '17 14:08 Zeblote

There was no problem in building with GYP. If it is a GN build only problem, it is assumed that config is different.

crocuis avatar Aug 26 '17 14:08 crocuis

Ok, it seems to work if I also copy over v8/out.gn/x64.release/obj/src/inspector/inspector.lib and add PublicAdditionalLibraries.Add("shlwapi.lib"); to V8.Build.cs.

Is there any advantage to building with GN then? I only wanted to use that because the v8 wiki says GYP is supposed to be deprecated and removed soon.

Zeblote avatar Aug 26 '17 14:08 Zeblote

When I built V8, I did not know about building V8 with GN. If building V8 with GN works well, please update to GN build at https://github.com/ncsoft/Unreal.js/wiki/V8.

crocuis avatar Aug 26 '17 15:08 crocuis

I build v8(Version 6.2) with gn. UnrealEngine crashes when loading "UnrealJS plugin" image image

tank90fc avatar Aug 31 '17 02:08 tank90fc

Since version v8 (Version 6.2) is not officially released, there may be several internal problems. If the V8 API has changed or if it is necessary to implement it, I will add it later.

crocuis avatar Aug 31 '17 16:08 crocuis

I build v8(Version 6.2) with gn. UnrealEngine crashes when loading "UnrealJS plugin" image image

@crocuis I have the same error. Now, have you resolved it?

hamkoo avatar Jul 13 '19 15:07 hamkoo