node-v8
node-v8 copied to clipboard
Build error on Windows
https://ci.nodejs.org/job/node-compile-windows-debug/12735/nodes=win-vs2019/console
14:33:41 C:\workspace\node-compile-windows-debug\node\deps\v8\src\wasm\wasm-disassembler-impl.h(77,52): error C2487: 'v8::internal::wasm::WasmDecoder<v8::internal::wasm::Decoder::kFullValidation,v8::internal::wasm::kFunctionBody>::StackEffect': member of dll interface class may not be declared with dll interface [C:\workspace\node-compile-windows-debug\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
@nodejs/platform-windows
This is actually not specific to debug builds.
I just created an upstream issue: https://bugs.chromium.org/p/v8/issues/detail?id=13093
Unfortunately this is still happening...
https://github.com/nodejs/node-v8/runs/8087799918?check_suite_focus=true
Bit of a long shot but does this help?
diff --git a/src/wasm/function-body-decoder-impl.h b/src/wasm/function-body-decoder-impl.h
index f8ca69d8485..5ef0eed5aed 100644
--- a/src/wasm/function-body-decoder-impl.h
+++ b/src/wasm/function-body-decoder-impl.h
@@ -2136,7 +2136,7 @@ class WasmDecoder : public Decoder {
}
// TODO(clemensb): This is only used by the interpreter; move there.
- V8_EXPORT_PRIVATE std::pair<uint32_t, uint32_t> StackEffect(const byte* pc) {
+ std::pair<uint32_t, uint32_t> StackEffect(const byte* pc) {
WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
// Handle "simple" opcodes with a fixed signature first.
const FunctionSig* sig = WasmOpcodes::Signature(opcode);
WasmDecoder is a template class. Annotating members with __declspec(dllexport) doesn't seem appropriate.
Let's try: https://ci.nodejs.org/job/node-test-commit-windows-fanned/50518/ https://github.com/targos/node/commit/ae23865d822f33b75a062cbbe5051da35e9f2511
@bnoordhuis looks good (arm64 build failed because of https://github.com/nodejs/node-v8/issues/240)!
Nice. I'll open a V8 CL tomorrow.
@bnoordhuis can you please post a link to the V8 CL here?
Just a thought, but this might be related to nodejs build system layer (gyp).
V8_EXPORT_PRIVATE is defined here following other macros:
// Setup for Windows shared library export.
#ifdef BUILDING_V8_SHARED
#define V8_EXPORT_PRIVATE __declspec(dllexport)
#elif USING_V8_SHARED
#define V8_EXPORT_PRIVATE __declspec(dllimport)
#else
#define V8_EXPORT_PRIVATE
#endif // BUILDING_V8_SHARED
Those macros are set in tools/v8_gypfiles/v8.gyp.
The solution to remove V8_EXPORT_PRIVATE for StackEffect function is equivalent to not declare BUILDING_V8_SHARED nor USING_V8_SHARED.
@targos I can confirm this compilation error is not present when building v8 directly. I'd suggest a fix around nodejs build system with macros explained above.
@pbo-linaro would you be able to identify exactly where the wrong macro is set?
I'll try to look at it, but that would be better if someone who worked on gyp/gn layer tackles this. First, I'm working to upstream https://github.com/nodejs/node-v8/issues/240.
@targos: For now, how do you deal with custom patches that nodejs applies to v8? Are there kept somewhere?
I keep them on the canary-base branch (https://github.com/nodejs/node/tree/canary-base) which I rebase from time to time (usually when the daily update workflow of this repo fails because of a conflict)
You can safely remove that V8_EXPORT_PRIVATE in src/wasm/function-body-decoder-impl.h.
Another class inherits from the one defining this StackEffect function, and reuse V8_EXPORT_PRIVATE, which is forbidden by msvc (should be defined either at class or method level, but not both).
@targos After trying random stuff around node build system, I could not get something that was solving this issue. I suggest you keep a patch (on node side) removing that export for now.
Will do, thanks a lot for investigating!