From 114680f6c3f311d102bcc34c54009b0dbd9c8725 Mon Sep 17 00:00:00 2001 From: davidhouweling Date: Thu, 28 Nov 2019 01:22:53 +0000 Subject: [PATCH 1/3] build: fix missing winmm dependency in libnode when compiling windows dll (shared mode), v8_libbase.vcxproj requires winmm.lib which are not being picked up by libnode. In the normal mode it is picked up via another dependency route. However, in the shared mode, the indirect dependency is not added. Fixes: https://github.com/nodejs/node/issues/28845 --- node.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/node.gyp b/node.gyp index 3c6a85737078c0..a8cc487cd5f415 100644 --- a/node.gyp +++ b/node.gyp @@ -746,6 +746,7 @@ 'libraries': [ 'Dbghelp', 'Psapi', + 'Winmm', ], }], [ 'node_use_etw=="true"', { From 12c77399117cf6a359967e7c9343d9323c60170d Mon Sep 17 00:00:00 2001 From: davidhouweling Date: Thu, 28 Nov 2019 01:28:58 +0000 Subject: [PATCH 2/3] build: fix share mode for windows to output libnode as lib When compiling node as a dll, libnode must be compiled as a lib instead of a dll. Having it compiled as a dll triggers node.vcxproj to compile libnode as a lib, meaning duplicate definitions appear causing the compiler to throw an error when compiling node Fixes: https://github.com/nodejs/node/issues/28845 --- node.gyp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/node.gyp b/node.gyp index a8cc487cd5f415..9a937ef53ae69e 100644 --- a/node.gyp +++ b/node.gyp @@ -251,14 +251,16 @@ [ 'node_shared=="true"', { 'node_target_type%': 'shared_library', 'conditions': [ - ['OS=="aix"', { + ['OS in ("aix", "win")', { # For AIX, always generate static library first, # It needs an extra step to generate exp and # then use both static lib and exp to create # shared lib. - 'node_intermediate_lib_type': 'static_library', + # For Windows, always generate static library, + # which is necessary to compile node.dll + 'node_intermediate_lib_type%': 'static_library', }, { - 'node_intermediate_lib_type': 'shared_library', + 'node_intermediate_lib_type%': 'shared_library', }], ], }, { From 474f6e988edd29ba5af114c735df8ab9603b0a7f Mon Sep 17 00:00:00 2001 From: davidhouweling Date: Thu, 28 Nov 2019 01:32:03 +0000 Subject: [PATCH 3/3] build: fix node compile to output correctly in shared mode When compiling node in shared mode, the output should be a shared library rather than an executable. Fixes: https://github.com/nodejs/node/issues/28845 --- node.gyp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node.gyp b/node.gyp index 9a937ef53ae69e..820fcef7cb28e1 100644 --- a/node.gyp +++ b/node.gyp @@ -23,6 +23,7 @@ 'node_shared_openssl%': 'false', 'node_v8_options%': '', 'node_core_target_name%': 'node', + 'node_target_type%': 'executable', 'node_lib_target_name%': 'libnode', 'node_intermediate_lib_type%': 'static_library', 'node_builtin_modules_path%': '', @@ -315,7 +316,7 @@ 'targets': [ { 'target_name': '<(node_core_target_name)', - 'type': 'executable', + 'type': '<(node_target_type)', 'defines': [ 'NODE_WANT_INTERNALS=1',