Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for electron 32 #973

Open
steinmetz85 opened this issue Aug 21, 2024 · 27 comments
Open

support for electron 32 #973

steinmetz85 opened this issue Aug 21, 2024 · 27 comments

Comments

@steinmetz85
Copy link

steinmetz85 commented Aug 21, 2024

With electron 32.0.1 and its underlying v8 version 12.8, there are mulitple errors when building NAN modules:

nan.h(700,39): error C2039: "IdleNotificationDeadline" ist kein Member von "v8::Isolate"
nan.h(2560,8): error C2039: "SetAccessor" ist kein Member von "v8::ObjectTemplate"
nan.h(2654,15): error C2039: "SetAccessor" ist kein Member von "v8::Object"
nan.h(2730,56): error C2440: "": "initializer list" kann nicht in "v8::NamedPropertyHandlerConfiguration" konvertiert werden
nan_scriptorigin.h(19,1): error C2664: "v8::ScriptOrigin::ScriptOrigin(v8::Localv8::Value,int,int,bool,int,v8::Localv8::Value,bool,bool,bool,v8::Localv8::Data)" : Konvertierung von Argument 1 von "v8::Isolate *" in "v8::Localv8::Value" nicht möglich

@agracio
Copy link

agracio commented Aug 21, 2024

In Electron v31 the following lines appeared as warnings

node_modules\nan\nan.h(700,39): warning C4996: 'v8::Isolate::IdleNotificationDeadline' : Use MemoryPressureNotification() to influence the GC schedule. 
node_modules\nan\nan.h(2654,15): warning C4996: 'v8::Object::SetAccessor': Use SetNativeDataProperty instead 
node_modules\nan\nan.h(2730,56): warning C4996: 'v8::NamedPropertyHandlerConfiguration ::NamedPropertyHandlerConfiguration': Provide interceptor callbacks with new signatures instead (NamedPropertyXxxCallback)

node_modules\nan\nan_scriptorigin.h(19,23): warning C4996: 'v8::ScriptOrigin::ScriptOrigin': Use constructor without the isolate. 
node_modules\nan\nan_scriptorigin.h(23,23): warning C4996: 'v8::ScriptOrigin::ScriptOrigin': Use constructor without the isolate. 
node_modules\nan\nan_scriptorigin.h(30,23): warning C4996: 'v8::ScriptOrigin::ScriptOrigin': Use constructor without the isolate. 

In Electron v32 it now throws these errors:

node_modules\nan\nan.h(700,39): error C2039: 'IdleNotificationDeadline': is not a member of 'v8::Isolate' 
node_modules\nan\nan.h(2560,8): error C2039: 'SetAccessor': is not a member of 'v8::ObjectTemplate' 
node_modules\nan\nan.h(2608,8): error C2039: 'SetAccessor': is not a member of 'v8::ObjectTemplate'
node_modules\nan\nan.h(2654,15): error C2039: 'SetAccessor': is not a member of 'v8::Object' 
node_modules\nan\nan.h(2730,56): error C2440: '<function-style-cast>': cannot convert
from 'initializer list' to 'v8::NamedPropertyHandlerConfiguration'
node_modules\nan\nan.h(2800,58): error C2440: '<function-style-cast>': cannot convert
from 'initializer list' to 'v8::IndexedPropertyHandlerConfiguration'

node_modules\nan\nan_scriptorigin.h(19,23): error C2664: 'v8::ScriptOrigin::ScriptOrig in(v8::Local<v8::Value>,int,int,bool,int,v8::Local<v8::Value>,bool,bool,bool,v8::Local<v8::Data>)': cannot convert argument 1 from 'v8::Isolate *' to 'v8::Local<v8::Value>' 
node_modules\nan\nan_scriptorigin.h(23,23): error C2664: 'v8::ScriptOrigin::ScriptOrig in(v8::Local<v8::Value>,int,int,bool,int,v8::Local<v8::Value>,bool,bool,bool,v8::Local<v8::Data>)': cannot convert argument 1 from 'v8::Isolate *' to 'v8::Local<v8::Value>' 
node_modules\nan\nan_scriptorigin.h(30,23): error C2664: 'v8::ScriptOrigin::ScriptOrig in(v8::Local<v8::Value>,int,int,bool,int,v8::Local<v8::Value>,bool,bool,bool,v8::Local<v8::Data>)': cannot convert argument 1 from 'v8::Isolate *' to 'v8::Local<v8::Value>' 


@kkoopa
Copy link
Collaborator

kkoopa commented Aug 22, 2024

Based on v8/v8@6ec8839 since V8 12.5.59 there is a need to use the Local<Name> version of SetAccessor instead. IdleNotificationDeadline is deprecated with no replacement since V8 11.3.218 and removed in v8/v8@c8c168f V8 12.7.41.

@agracio
Copy link

agracio commented Aug 22, 2024

Could this used be to replace IdleNotificationDeadline in a different part of the code?

node_modules\nan\nan.h(700,39): warning C4996: 'v8::Isolate::IdleNotificationDeadline' : Use MemoryPressureNotification() to influence the GC schedule. 

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 22, 2024 via email

@kkoopa kkoopa mentioned this issue Aug 24, 2024
@kkoopa
Copy link
Collaborator

kkoopa commented Aug 24, 2024

I created an untested PR that should deal with this. Please try it out.

@agracio
Copy link

agracio commented Aug 24, 2024

I am getting this error

node_modules\nan\nan.h(2567,138): error C1012: unmatched parenthesis: missing ')'
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5)

// this part has 3 opening '(' and 2 closing ')'
&& (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5)

Same in lines 2619, 2672

nan_callbacks_12_inl.h missing closing ')' in lines 264, 308, 374, 418, 550, 592, 659, 701

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Thanks for reporting, I have updated the PR.

@agracio
Copy link

agracio commented Aug 26, 2024

Ok this one is on me, instead of just building your branch of nan and finding all the errors encountered on build I should have changed the files in my project's node_modules/nan.
Apologies for adding additional work when I could have checked it myself.

node_modules\nan\nan.h(2673,15): error C2664: 'v8::Maybe<bool> v8::Object::SetNativeDataProperty(v8::Local<v8::Context>,v8::Local<v8::Name>,v8::AccessorNameGetterCallback,v8::AccessorNameSetterCallback,v8::Lo cal<v8::Value>,v8::PropertyAttribute,v8::SideEffectType,v8::SideEffectType)': cannot convert argument 6 from 'v8::AccessCo ntrol' to 'v8::PropertyAttribute' 
node_modules\nan\nan.h(2752,56): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'v8::NamedPropertyHandlerConfiguration'
node_modules\nan\nan.h(2822,58): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'v8::IndexedPropertyHandlerConfiguration' 

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Alright, so v8::AccessControl has been removed. This requires a long dance of deprecating and splitting out functions with default arguments to overloads in order to remove the argument from Nan::SetAccessor. It is doable, but tedious. I do not see what is wrong with the Property Handler Configurations, they are supposed to correspond to this constructor.

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Apparently AccessControl is already being silently ignored on the other form of Nan::SetAccessor, so I won't bother cleaning it. I fixed the SetNativeDataProperty call, but I still cannot tell what is wrong with creating the property handler configurations.

@agracio
Copy link

agracio commented Aug 26, 2024

After the fix now getting even more very strange errors.
But this time only one '<function-style-cast>': cannot convert from 'initializer list' to 'v8::IndexedPropertyHandlerConfiguration'

nan_callbacks_12_inl.h(277,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(277,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(277,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(277,34): error C2039:             T=v8::Value [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(277,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(322,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(322,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(322,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(322,34): error C2039:             T=v8::Value [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(322,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(387,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(387,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(387,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(387,34): error C2039:             T=v8::Boolean [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(387,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(431,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(431,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(431,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(431,34): error C2039:             T=v8::Integer [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(431,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(562,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(562,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(562,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(562,34): error C2039:             T=v8::Value [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(562,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(606,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(606,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(606,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(606,34): error C2039:             T=v8::Value [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(606,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(671,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(671,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(671,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(671,34): error C2039:             T=v8::Boolea n [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(671,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(713,34): error C2039: 'Get': is not a member of 'Nan::ReturnValue<T>' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(713,34): error C2039:         with [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(713,34): error C2039:         [ [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(713,34): error C2039:             T=v8::Integer [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan_callbacks_12_inl.h(713,34): error C2039:         ] [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan.h(2717,30): error C2072: 'deleter_': initialization of a function  [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan.h(2759,33): error C2065: 'deleter_': undeclared identifier [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]
nan.h(2828,58): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'v8::IndexedPropertyHandlerConfiguration' [C:\path\electron-edge-js\build\edge_coreclr.vcxproj]

EDIT: If that helps your branch of nan builds 'Test' build and runs npm test after that without any problems.

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Okay, that one about missing Get was my oversight. I missed that the CallbackInfo object was from NAN and does not have a way of getting the actual value. I tried to do something with a friend function to get around it, but it still might need some massaging before it compiles. I currently do not have anything set up with such a new V8 version so I cannot easily test myself.

@agracio
Copy link

agracio commented Aug 26, 2024

Well here is a new list of errors

nan_callbacks_12_inl.h(19,35): error C7568: argument list missing after assumed function template 'ReturnValue' 
nan_callbacks_12_inl.h(19,29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
nan_callbacks_12_inl.h(19,35): error C2144: syntax error: 'unknown-type' should be preceded by ')' 
nan_callbacks_12_inl.h(19,35): error C2144: syntax error: 'unknown-type' should be preceded by ';' 
nan_callbacks_12_inl.h(19,53): error C2059: syntax error: ')' 
nan_callbacks_12_inl.h(19,54): error C2988: unrecognizable template declaration/definition 
nan_callbacks_12_inl.h(19,54): error C2143: syntax error: missing ';'  before '<end Parse>' 
nan_callbacks_12_inl.h(20,1): error C2988: unrecognizable template de claration/definition 
nan_callbacks_12_inl.h(20,1): error C2059: syntax error: '}' 
nan_callbacks_12_inl.h(20,1): error C2143: syntax error: missing ';' before '}' 
nan_callbacks_12_inl.h(122,10): error C2977: 'Nan::imp::ReturnValue':  too many template arguments 
nan_callbacks_12_inl.h(122,25): error C2955: 'Nan::imp::ReturnValue':  use of class template requires template argument list 
nan_callbacks_12_inl.h(122,25): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(168,10): error C2977: 'Nan::imp::ReturnValue':  too many template arguments 
nan_callbacks_12_inl.h(168,25): error C2955: 'Nan::imp::ReturnValue':  use of class template requires template argument list 
nan_callbacks_12_inl.h(168,25): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(285,42): error C2977: 'Nan::imp::ReturnValue':  too many template arguments 
nan_callbacks_12_inl.h(285,58): error C2955: 'Nan::imp::ReturnValue':  use of class template requires template argument list 
nan_callbacks_12_inl.h(286,13): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(300,39): error C2664: 'void (v8::Local<v8::Str ing>,const Nan::PropertyCallbackInfo<v8::Value> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8::Va lue>' to 'const Nan::PropertyCallbackInfo<v8::Value> &'  nan_callbacks_12_inl.h(301,37): error C2027: use of undefined type 'N an::imp::ReturnValue' 
nan_callbacks_12_inl.h(301,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(345,46): error C2664: 'void (v8::Local<v8::String>,v8::Local<v8::Value>,const Nan::PropertyCallbackInfo<v8::Value> &)': cannot convert argument 3 from 'Nan::imp::Proper tyCallbackInfo<v8::Value>' to 'const Nan::PropertyCallbackInfo<v8::Value> &' 
nan_callbacks_12_inl.h(346,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(346,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(388,12): error C2664: 'void (const Nan::PropertyCallbackInfo<v8::Array> &)': cannot convert argument 1 from 'Nan::imp::PropertyCallbackInfo<v8::Array>' to 'const Nan::P ropertyCallbackInfo<v8::Array> &' 
nan_callbacks_12_inl.h(410,39): error C2664: 'void (v8::Local<v8::String>,const Nan::PropertyCallbackInfo<v8::Boolean> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8:: Boolean>' to 'const Nan::PropertyCallbackInfo<v8::Boolean> &' 
nan_callbacks_12_inl.h(411,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(411,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(454,39): error C2664: 'void (v8::Local<v8::String>,const Nan::PropertyCallbackInfo<v8::Integer> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8:: Integer>' to 'const Nan::PropertyCallbackInfo<v8::Integer> &' 
nan_callbacks_12_inl.h(455,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(455,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(585,19): error C2664: 'void (uint32_t,const Nan::PropertyCallbackInfo<v8::Value> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8::Value>' to 'con st Nan::PropertyCallbackInfo<v8::Value> &' 
nan_callbacks_12_inl.h(586,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(586,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(629,26): error C2664: 'void (uint32_t,v8::Local<v8::Value>,const Nan::PropertyCallbackInfo<v8::Value> &)': cannot convert argument 3 from 'Nan::imp::PropertyCallbackInf o<v8::Value>' to 'const Nan::PropertyCallbackInfo<v8::Value> &' 
nan_callbacks_12_inl.h(630,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(630,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(673,12): error C2664: 'void (const Nan::PropertyCallbackInfo<v8::Array> &)': cannot convert argument 1 from 'Nan::imp::PropertyCallbackInfo<v8::Array>' to 'const Nan::P ropertyCallbackInfo<v8::Array> &' 
nan_callbacks_12_inl.h(694,19): error C2664: 'void (uint32_t,const Nan::PropertyCallbackInfo<v8::Boolean> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8::Boolean>' to 'const Nan::PropertyCallbackInfo<v8::Boolean> &' 
nan_callbacks_12_inl.h(695,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(695,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_callbacks_12_inl.h(736,19): error C2664: 'void (uint32_t,const Nan::PropertyCallbackInfo<v8::Integer> &)': cannot convert argument 2 from 'Nan::imp::PropertyCallbackInfo<v8::Integer>' to 'const Nan::PropertyCallbackInfo<v8::Integer> &' 
nan_callbacks_12_inl.h(737,37): error C2027: use of undefined type 'Nan::imp::ReturnValue' 
nan_callbacks_12_inl.h(737,15): error C2672: 'Nan::imp::imp::GetReturnValue': no matching overloaded function found 
nan_new.h(21,15): error C2039: 'To': is not a member of 'Nan' 
nan_new.h(21,22): error C2275: 'v8::Integer': expected an expression instead of a type 
nan_new.h(21,34): error C2039: 'ToLocalChecked': is not a member of ' v8::Local<v8::Integer>' 
nan_new.h(28,15): error C2039: 'To': is not a member of 'Nan' 
nan_new.h(28,22): error C2275: 'v8::Int32': expected an expression instead of a type 
nan_new.h(28,32): error C2039: 'ToLocalChecked': is not a member of ' v8::Local<v8::Integer>' 
nan_new.h(35,15): error C2039: 'To': is not a member of 'Nan' 
nan_new.h(35,22): error C2275: 'v8::Uint32': expected an expression instead of a type 
nan_new.h(35,22): error C1003: error count exceeds 100; stopping compilation 

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

The friend declaration was not correct. Now it should compile.

@agracio
Copy link

agracio commented Aug 26, 2024

Now only have these 2 left, happens on Electron 31 and 32 version 30 runs without those problems.

nan.h(2758,56): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'v8::NamedPropertyHandlerConfiguration' 
nan.h(2828,58): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'v8::IndexedPropertyHandlerConfiguration' 

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Great. It is moving in the right direction. I noticed that the signature of property setters had changed further, so I made another update.

@agracio
Copy link

agracio commented Aug 26, 2024

Getting closer

nan_callbacks_12_inl.h(344,13): error C2664: 'Nan::PropertyCallbackIn fo<v8::Value>::PropertyCallbackInfo(const v8::PropertyCallbackInfo<v8::Value> &,const v8::Local<v8::Value>)': cannot convert argument 1 from 'const v8::PropertyCallbackInfo<void>' to 'const v8::PropertyCallbackInfo<v8::Value> &' 
nan_callbacks_12_inl.h(628,13): error C2664: 'Nan::PropertyCallbackIn fo<v8::Value>::PropertyCallbackInfo(const v8::PropertyCallbackInfo<v8::Value> &,const v8::Local<v8::Value>)': cannot convert argument 1 from 'const v8::PropertyCallbackInfo<void>' to 'const v8::PropertyCallbackInfo<v8::Value> &' 

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

That is unfortunate. I cannot think of a reasonable way of taking a v8::PropertyCallbackInfo<void> and somehow making aNan::PropertyCallbackInfo<v8::Value>. Hence, this seems to require breaking the signature of property setter callbacks, but I cannot make them compatible for all supported versions. Unless someone can come up with a solution, I guess this is it.

@agracio
Copy link

agracio commented Aug 26, 2024

I guess this is it.

You mean there isnt a way for nan to support Electron 32+ or anything based on newer versions of v8?

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

Unfortunately, that is how it appears. It might not be the final answer, but I cannot think of a solution for papering over this change.

@agracio
Copy link

agracio commented Aug 26, 2024

I understand that this appears to be an issue that cannot be dealt with easily but should nan users expect any long term plan for Electron 32+ support?
Unlike Node.js Electron does not offer long term support for its versions and in about 6 or even less months v32 will become the last supported version with release of v33 and v34.
And this issue is likely not only limited to Electron but to other apps that will slowly migrate to newer versions of v8.

@kkoopa
Copy link
Collaborator

kkoopa commented Aug 26, 2024

The goal of this project has always been to provide backwards compatibility by providing a consistent API across all versions. I have wondered for the past ten years when a breaking change would come. The cause for this change in V8 is compliance with the ECMAScript standard, changing the underlying semantics. Last time a big break came was whatever V8 version came with Node 4.3, which added the optionals (Maybe, MaybeLocal), but that could still be shoehorned in to the older versions. The difference here is that I do not see a clear way of making the callback signatures work backwards. The internals of V8 are locked down through private access modifiers, making it nigh impossible to do many of the required behind-the-scenes operations when trying to modify its behavior from the outside.

Now, supposing that this last issue with the callbacks could be resolved, it would also be necessary to detect if the callback has thrown an exception and account for that when returning the boolean indicating whether the interceptor did anything. There might be more gotchas hiding in the rough. I have not looked into the feasibility of this.

@agracio
Copy link

agracio commented Aug 26, 2024

So if I understand it correctly you saying there are no plans to add support for newer v8 versions in any foreseeable future?

@agnat
Copy link
Collaborator

agnat commented Aug 26, 2024

Plonk.

should nan users expect any long term plan for Electron 32+ support?

This is a common misconception. We don't support electron. If you look at the README electron isn't mentioned anywhere. It's the other way around: Electron promises compatibility with node.js ... and breaks that promise on a regular basis. This is also why, from our perspective, projects like electron, some call them franken-builds, are a bit of a nuisance.

Anyway, after a quick glance I agree with @kkoopa. This looks like an upcoming breaking change. NAN 3.0 ... finally... yay?

And this issue is likely not only limited to Electron but to other apps that will slowly migrate to newer versions of v8.

... and when that happens I'm sure we will take another stab at it. 😁

@steinmetz85
Copy link
Author

Thanks to everyone for the work!
Just to repeat it: It is not a problem with electron, but with v8 12.8+. electron is an early bird using v8 versions, but it has nothing to do with electron. So it doesn't matter, if you like it or not :-)
I understand, that you try to support older versions, but this is not a "forever" concept. There will be breaking changes from time to time. And upcoming versions of node.js will have the same problem.

@agracio
Copy link

agracio commented Aug 31, 2024

@steinmetz85 I think it was not the case of Electron being an early adopter but rather that Chromium v128 was shipping with v8 12.8, but I might be entirely wrong.

It appears that v8 12.8 was added to main Node.js branch a couple of weeks ago so fingers crossed for Node.js v23 nan support or maybe even earlier while v23 pre-release undergoing testing.

https://github.com/nodejs/node/blob/main/deps/v8/include/v8-version.h

Commit: deps: update V8 to 12.8.374.13

@agracio
Copy link

agracio commented Sep 3, 2024

First of all wanted to say that I do appreciate the work, very quick responses and attempts to fix the error from everyone, in my previous posts I was rather frustrated that the problem is being ignored since nan only covers Node.js and other projects are left to fend for themselves.

Now that v8 12.8 was merged into main Node.js branch 23.0.0 I tested on a different project that does not depend on Electron and unfortunately getting exact same errors.

Commit: deps: update V8 to 12.8.374.13

Initially getting the same errors as with Electron build and after applying patch from new_breakage branch it is back to

nan_callbacks_12_inl.h(344,13): error C2664: 'Nan::PropertyCallbackInfo<v8::Value>::PropertyCallbackInfo(const v8::PropertyCallbackInfo<v8::Value> &,const v8::Local<v8::Value>)': cannot convert argument 1 from 'const v8::PropertyCallbackInfo<void>' to 'const v8::PropertyCallbackInfo<v8::Value> &' 
nan_callbacks_12_inl.h(628,13): error C2664: 'Nan::PropertyCallbackInfo<v8::Value>::PropertyCallbackInfo(const v8::PropertyCallbackInfo<v8::Value> &,const v8::Local<v8::Value>)': cannot convert argument 1 from 'const v8::PropertyCallbackInfo<void>' to 'const v8::PropertyCallbackInfo<v8::Value> &' 

And this issue is likely not only limited to Electron but to other apps that will slowly migrate to newer versions of v8.
... and when that happens I'm sure we will take another stab at it.😁

Node.js 23 release is a couple months away so while it does not require urgent attention perhaps there should be some plans to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants