-
Notifications
You must be signed in to change notification settings - Fork 617
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
Build failure with Node.js 12.x #969
Comments
Hi @sgallagher, maybe follow this for now, as I don't think there is a swig patch ready yet. |
Hi @Propanu @sgallagher ,
I have tried some unsuccessfull tricks but I am not able to contribute on this ;-( . As nodejs is rushing to newer and newer versions node.js 13;x is out we may need to call for support because if we stay stucked on nodejs 10.x all this fantastic software may loose part of its interest. I can help with checking/testing but unfortunately no more. Thanks for this work, hope a solution will come up.... |
This is causing us a lot of issues in Fedora, and given there's been no movement upstream and frankly this project appears almost dead, I'm considering just retiring it all. |
The problem comes from the interaction between node-swig-C++ . I understand that it requires advanced skills but I do not know any equivalent resource to propose a learning platform for IoT or any type of sensor or any GPIO connected tool enabling programming in three languages. We use Jupyter on raspberries and it is fun and efficiency. It would be very sad that this project vanishes. |
The Swig/Node integration has always been quite fragile. I've been a bit busy with other stuff recent and haven't been able to give much time to mraa ontop of the ongoing move to the Eclipse Foundation. |
OK thanks for the job anyway. If you tackle the problem let me know. |
Hi @tingleby just a little reminder on that point nothing seems to move on swig side I tested the compilation on a raspi4 with swwig4.0.2 and NodeJS13.5.0 |
Trying the patch from [1] with mraa 2.1.0 it still fails with newer NodeJS :( [1] swig/swig#1702 |
As documented on this PR / issue, my patch is incomplete because I've only tested on our usecase. Feel free to help getting the PR to work properly with Travis to help getting more coverage. |
The main issue for me is the
In the recent Node.js versions it requires 4 parameters instead of 3 (see API) The errors related to the Buffer can be worked around via just invoking the code parts for |
This seems to be working.
|
@nxhack is this with the latest version of SWIG, or does it also require the unmerged patches I mentioned earlier on this issue? Since the latest versions of node don't compile out of the box we decided to disable node.js builds by default for the next release. Easy to undo in a future release when all the needed bits are in place. Thanks. |
This is a case of applying the patch we are considering in SWIG. I've applied these patches to the OpenWrt packages I maintain and so far there don't seem to be any reports of problems. (I don't know how many users are out there.) (This OpenWrt package is intended for node v12 and above.) |
Hi @Propanu @nxhack ,Thanks for your work, I tried your patch on current master Compilation fails with 45 errors (17 first occurences are listed below), I am not able to build patches but I can test solutions if any proposal. It seems that v8::MaybeLocalv8::String errors disappear using #define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str).ToLocalChecked()
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym).ToLocalChecked()
//#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len).ToLocalChecked()
//cdata->handle.MarkIndependent();
cdata->handle.SetWeak()
//_exports_uint8Array_class_0->SetHiddenPrototype(true);
_exports_uint8Array_class_0->ReadOnlyPrototype();
//v8::Local<v8::Object> _exports_uint8Array_obj = _exports_uint8Array_class_0->GetFunction();
v8::Handle<v8::Object> _exports_uint8Array_obj = _exports_uint8Array_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Gpio_class_0->SetHiddenPrototype(true);
_exports_Gpio_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Gpio_obj = _exports_Gpio_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Gpio_obj = _exports_Gpio_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_I2c_class_0->SetHiddenPrototype(true);
_exports_I2c_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_I2c_obj = _exports_I2c_class_0->GetFunction();
v8::Handle<v8::Object> _exports_I2c_obj = _exports_I2c_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Pwm_class_0->SetHiddenPrototype(true);
_exports_Pwm_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Pwm_obj = _exports_Pwm_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Pwm_obj = _exports_Pwm_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Spi_class_0->SetHiddenPrototype(true);
_exports_Spi_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Spi_obj = _exports_Spi_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Spi_obj = _exports_Spi_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Aio_class_0->SetHiddenPrototype(true);
_exports_Aio_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Aio_obj = _exports_Aio_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Aio_obj = _exports_Aio_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Uart_class_0->SetHiddenPrototype(true);
_exports_Uart_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Uart_obj = _exports_Uart_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Uart_obj = _exports_Uart_class_0->NewRemoteInstance().ToLocalChecked();
//_exports_Led_class_0->SetHiddenPrototype(true);
_exports_Led_class_0->ReadOnlyPrototype();
//v8::Handle<v8::Object> _exports_Led_obj = _exports_Led_class_0->GetFunction();
v8::Handle<v8::Object> _exports_Led_obj = _exports_Led_class_0->NewRemoteInstance().ToLocalChecked();
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_uint8Array_obj, SWIGV8_SYMBOL_NEW("uint8Array").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Gpio_obj, SWIGV8_SYMBOL_NEW("Gpio").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_I2c_obj, SWIGV8_SYMBOL_NEW("I2c").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Pwm_obj, SWIGV8_SYMBOL_NEW("Pwm").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Spi_obj, SWIGV8_SYMBOL_NEW("Spi").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Aio_obj, SWIGV8_SYMBOL_NEW("Aio").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Uart_obj, SWIGV8_SYMBOL_NEW("Uart").ToLocalChecked());
exports_obj->Set(SWIGV8_CURRENT_CONTEXT(), _exports_Led_obj, SWIGV8_SYMBOL_NEW("Led").ToLocalChecked()); mraajsJAVASCRIPT_wrap.cxx:903:69: error: no matching function for call to ‘v8::Exception::Error(v8::MaybeLocal<v8::String>)’
mraajsJAVASCRIPT_wrap.cxx: In member function ‘virtual void OverloadErrorHandler::error(int, const char*)’:
mraajsJAVASCRIPT_wrap.cxx:1137:17: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘MarkIndependent’
mraajsJAVASCRIPT_wrap.cxx:1188:79: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
mraajsJAVASCRIPT_wrap.cxx:1285:128: error: no matching function for call to ‘v8::Private::ForApi(v8::Isolate*, v8::MaybeLocal<v8::String>)’
mraajsJAVASCRIPT_wrap.cxx:887:85: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>)’
mraajsJAVASCRIPT_wrap.cxx:1412:17: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘MarkIndependent’
mraajsJAVASCRIPT_wrap.cxx:1444:30: error: no matching function for call to ‘v8::Array::Set(uint32_t, v8::Handle<v8::Value>&)’
mraajsJAVASCRIPT_wrap.cxx:1476:56: error: no matching function for call to ‘v8::FunctionTemplate::SetClassName(v8::MaybeLocal<v8::String>)’
mraajsJAVASCRIPT_wrap.cxx:1482:96: error: no matching function for call to ‘v8::ObjectTemplate::Set(v8::MaybeLocal<v8::String>, v8::Local<v8::FunctionTemplate>)’
mraajsJAVASCRIPT_wrap.cxx:1505:69: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::MaybeLocal<v8::String>, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&))’
mraajsJAVASCRIPT_wrap.cxx:1513:83: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
mraajsJAVASCRIPT_wrap.cxx:1524:87: error: no matching function for call to ‘v8::Object::SetAccessor(v8::Local<v8::Context>, v8::MaybeLocal<v8::String>, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&))’
mraajsJAVASCRIPT_wrap.cxx:785:108: error: ‘kNormalString’ is not a member of ‘v8::String’
mraajsJAVASCRIPT_wrap.cxx:12395:30: error: ‘class v8::FunctionTemplate’ has no member named ‘SetHiddenPrototype’; did you mean ‘RemovePrototype’?
mraajsJAVASCRIPT_wrap.cxx:12396:91: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
mraajsJAVASCRIPT_wrap.cxx:12485:76: error: no matching function for call to ‘v8::Object::Set(v8::MaybeLocal<v8::String>, v8::Handle<v8::Object>&)’ |
Lack of "SWIG_V8_VERSION" consistency seems to be the root cause of this problem. |
While checking the handling of "SWIG_V8_VERSION" on the SWIG side, I made a patch for mraa and upm. SWIG: MRAA: UPM: |
When building against Node.js 12.4.0 on Fedora Rawhide, we get the following output:
The noteworthy piece is:
Node.js 12.x moved to running atop version 7.4 of v8, which is a backwards-incompatible major version upgrade from Node.js 10.x (which used version 6.8 of v8).
The text was updated successfully, but these errors were encountered: