Related to the issue with pinning nan 2.4.0, this project fails to build on newer versions of Node.js.
The main compile error from node-gyp is related to GetContents() being deprecated in Node.js 14.
Expand for full compile log:
../qrusage.cc: In function ‘double* getFloat64ArrayPointer(unsigned int, v8::Local<v8::Value>)’:
../qrusage.cc:25:55: error: ‘class v8::ArrayBuffer’ has no member named ‘GetContents’
25 | double* fields = static_cast<double*>(ab->GetContents().Data());
| ^~~~~~~~~~~
The fix can be seen in nan 2.4.1, which adds a C pre-processor directive checking for (V8_MAJOR_VERSION >= 8). If nodejs built-in V8 headers define this to be 8 or greater, then they use the new GetBackingStore() function. Otherwise, they fall back on using GetContents().
// Actually it's 7.9 here but this would lead to ABI issues with Node.js 13
// using 7.8 till 13.2.0.
#if (V8_MAJOR_VERSION >= 8)
data = static_cast<char*>(buffer->GetBackingStore()->Data()) + byte_offset;
#else
data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
#endif
The V8_MAJOR_VERSION definition can be found in v8-version.h from Node.js installation. Usually this is in /usr/include/node/v8-version.h.
Related to the issue with pinning nan
2.4.0, this project fails to build on newer versions of Node.js.The main compile error from
node-gypis related toGetContents()being deprecated in Node.js 14.Expand for full compile log:
The fix can be seen in nan
2.4.1, which adds a C pre-processor directive checking for(V8_MAJOR_VERSION >= 8). If nodejs built-in V8 headers define this to be 8 or greater, then they use the newGetBackingStore()function. Otherwise, they fall back on usingGetContents().The
V8_MAJOR_VERSIONdefinition can be found inv8-version.hfrom Node.js installation. Usually this is in/usr/include/node/v8-version.h.