node-openzwave-shared icon indicating copy to clipboard operation
node-openzwave-shared copied to clipboard

Compilation problem with Node 0.12.4

Open VirTERM opened this issue 11 years ago • 25 comments

Can not install it on CentOS 7 with Node 0.12.4:

make: Entering directory `/usr/local/lib/node_modules/openzwave-shared/build' CXX(target) Release/obj.target/openzwave_shared/src/openzwave.o In file included from /usr/local/include/openzwave/aes/aescpp.h:26:0, from /usr/local/include/openzwave/Driver.h:41, from /usr/local/include/openzwave/Manager.h:39, from ../src/openzwave.hpp:29, from ../src/openzwave.cc:18: /usr/local/include/openzwave/aes/aes.h:75:0: warning: ignoring #pragma warning [-Wunknown-pragmas] #pragma warning( disable : 4324 ) ^ /usr/local/include/openzwave/aes/aes.h:93:0: warning: ignoring #pragma warning [-Wunknown-pragmas] #pragma warning( default : 4324 ) ^ In file included from ../src/openzwave.cc:18:0: ../src/openzwave.hpp:96:26: error: expected class-name before ‘{’ token struct OZW : ObjectWrap { ^ ../src/openzwave.hpp:97:38: error: ‘Arguments’ does not name a type static Handlev8::Value New(const Arguments& args); ^ ../src/openzwave.hpp:97:49: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive] static Handlev8::Value New(const Arguments& args); ^ ../src/openzwave.hpp:99:49: error: ‘Arguments’ does not name a type static Handlev8::Value SetConfigParam(const Arguments& args); ^ ../src/openzwave.hpp:99:60: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive] static Handlev8::Value SetConfigParam(const Arguments& args); .......

VirTERM avatar Jun 05 '15 00:06 VirTERM

Sorry, node 0.12 not supported yet, it gave me serious headache. I've tried to port over simon-jentzsch's patch but it simply wasn't working due to the different way 0.12 copies function prototypes (basically: it doesn't!!!) I'll find my notes about this issue then resolve this call.

ekarak avatar Jun 05 '15 04:06 ekarak

Better get my #ifdef-fu ready for action: There are quite a few API-breaking changes in Node 0.12 - and this is not going to be easy.

ekarak avatar Jun 07 '15 05:06 ekarak

Could also try to use NaN - (think it stands for Node (is) a Nightmare)

ekarak avatar Jun 07 '15 05:06 ekarak

Hi Wojciech, I've just committed a 'nan' branch where all the Node.JS API is wrapped in NaN (Node.JS is A Nightmare) - please check out a copy of the code and give it a try. I haven't tried compiling it against 0.12, (might try this on a VM later today though). In case you get a TypeError: Illegal invocation while trying to invoke (eg 'zwave.setValue) then try calling it via the 'addon' object, for examplezwave.addon.setValue(....)`

ekarak avatar Jun 07 '15 10:06 ekarak

Hi Elias, Much better results, but still failing:

make: Entering directory /usr/local/lib/node_modules/openzwave-shared/build' CXX(target) Release/obj.target/openzwave_shared/src/openzwave.o In file included from /usr/local/include/openzwave/aes/aescpp.h:26, from /usr/local/include/openzwave/Driver.h:41, from /usr/local/include/openzwave/Manager.h:39, from ../src/openzwave.hpp:30, from ../src/openzwave.cc:18: /usr/local/include/openzwave/aes/aes.h:75: warning: ignoring #pragma warning /usr/local/include/openzwave/aes/aes.h:93: warning: ignoring #pragma warning ../src/openzwave.cc: In static member function ‘static void OZW::OZW::New(const v8::FunctionCallbackInfo<v8::Value>&)’: ../src/openzwave.cc:57: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:64: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:65: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:66: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:67: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:68: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc:70: error: ‘New’ is not a member of ‘v8::String’ ../src/openzwave.cc: In function ‘void OZW::init(v8::Handle<v8::Object>)’: ../src/openzwave.cc:142: error: ‘NewSymbol’ is not a member of ‘v8::String’ make: *** [Release/obj.target/openzwave_shared/src/openzwave.o] Error 1 make: Leaving directory/usr/local/lib/node_modules/openzwave-shared/build’

On Jun 7, 2015, at 6:17 AM, Elias Karakoulakis [email protected] wrote:

Hi Wojciech, I've just committed a 'nan' branch where all the Node.JS API is wrapped in NaN (Node.JS is A Nightmare) - please check out a copy of the code https://github.com/OpenZWave/node-openzwave-shared/tree/nan and give it a try. I haven't tried compiling it against 0.12, (might try this on a VM later today though)

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-109732703.

VirTERM avatar Jun 07 '15 12:06 VirTERM

Can you please give it another shot? I've replaced all String::New with NanNew<String>.

ekarak avatar Jun 07 '15 18:06 ekarak

Elias, Initially, it was still complaining about line 142 in openzwace.cc, I made the same change as you did in other places.

Now, this is what I see:

/usr/local/include/openzwave/aes/aes.h:75: warning: ignoring #pragma warning /usr/local/include/openzwave/aes/aes.h:93: warning: ignoring #pragma warning ../src/openzwave-driver.cc: In function ‘void OZW::Connect(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:33: error: invalid conversion from ‘void ()(uv_async_t, int)’ to ‘void ()(uv_async_t)’ ../src/openzwave-driver.cc:33: error: initializing argument 3 of ‘int uv_async_init(uv_loop_t_, uv_async_t_, void ()(uv_async_t))’ ../src/openzwave-driver.cc:35: error: no matching function for call to ‘v8::PersistentBasev8::Object::New(v8::Localv8::Object)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:572: note: candidates are: static T* v8::PersistentBase::New(v8::Isolate_, T_) [with T = v8::Object] ../src/openzwave-driver.cc:42: error: no matching function for call to ‘MakeCallback(v8::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >&, const char [5], int, v8::Handlev8::Value [1])’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:119: note: candidates are: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, const char_, int, v8::Handlev8::Value_) /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:125: note: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, v8::Handlev8::String, int, v8::Handlev8::Value_) /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:131: note: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, v8::Handlev8::Function, int, v8::Handlev8::Value_) ../src/openzwave-driver.cc: In function ‘void OZW::BeginControllerCommand(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:130: warning: ‘bool OpenZWave::Manager::BeginControllerCommand(uint32, OpenZWave::Driver::ControllerCommand, void ()(OpenZWave::Driver::ControllerState, OpenZWave::Driver::ControllerError, void), void_, bool, uint8, uint8)’ is deprecated (declared at /usr/local/include/openzwave/Manager.h:1640) ../src/openzwave-driver.cc: In function ‘void OZW::GetControllerNodeId(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:150: error: no matching function for call to ‘v8::Integer::New(uint8&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:2012: note: candidates are: static v8::Localv8::Integer v8::Integer::New(v8::Isolate_, int32_t) ../src/openzwave-driver.cc:150: error: return-statement with a value, in function returning 'void' ../src/openzwave-driver.cc: In function ‘void OZW::GetSUCNodeId(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:159: error: no matching function for call to ‘v8::Integer::New(uint8&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:2012: note: candidates are: static v8::Localv8::Integer v8::Integer::New(v8::Isolate_, int32_t) ../src/openzwave-driver.cc:159: error: return-statement with a value, in function returning 'void' ../src/openzwave-driver.cc: In function ‘void OZW::IsPrimaryController(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:173: error: no matching function for call to ‘v8::Boolean::New(bool&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:6183: note: candidates are: static v8::Handlev8::Boolean v8::Boolean::New(v8::Isolate_, bool) ../src/openzwave-driver.cc:173: error: return-statement with a value, in function returning 'void' ../src/openzwave-driver.cc: In function ‘void OZW::IsStaticUpdateController(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:187: error: no matching function for call to ‘v8::Boolean::New(bool&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:6183: note: candidates are: static v8::Handlev8::Boolean v8::Boolean::New(v8::Isolate_, bool) ../src/openzwave-driver.cc:187: error: return-statement with a value, in function returning 'void' ../src/openzwave-driver.cc: In function ‘void OZW::IsBridgeController(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:200: error: no matching function for call to ‘v8::Boolean::New(bool&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:6183: note: candidates are: static v8::Handlev8::Boolean v8::Boolean::New(v8::Isolate_, bool) ../src/openzwave-driver.cc:200: error: return-statement with a value, in function returning 'void' ../src/openzwave-driver.cc: In function ‘void OZW::GetSendQueueCount(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:244: error: no matching function for call to ‘v8::Integer::New(uint32&)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:2012: note: candidates are: static v8::Localv8::Integer v8::Integer::New(v8::Isolate_, int32_t) ../src/openzwave-driver.cc:244: error: return-statement with a value, in function returning 'void' make: *** [Release/obj.target/openzwave_shared/src/openzwave-driver.o] Error 1

On Jun 7, 2015, at 2:54 PM, Elias Karakoulakis [email protected] wrote:

Can you please give it another shot? I've replaced all String::New with NanNew.

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-109788317.

VirTERM avatar Jun 07 '15 19:06 VirTERM

yup, the same applies to Integer::New (should be NanNew<Integer>) However, there's a problem, Nan does not cast automatically from floats to the v8::Integer type, so the following line is more than probable to be your next error: // valobj->Set(NanNew<String>("value"), NanNew<Float>(val)); left it as it was: valobj->Set(NanNew<String>("value"), Integer::New(val)); there's no native Float in Javascript (go figure!) so I left it as it was. I need to contact the Nan people about this.

ekarak avatar Jun 07 '15 19:06 ekarak

OK, I've tried using OZW's getValueAsString to get the float values back as strings. It should compile now. Do you have any temperature sensors (or any zwave device that reports floating point values?)

ekarak avatar Jun 07 '15 20:06 ekarak

Yes, i do but i Will be ale to test it tomorrow afternoon EST... Thanks Wojtek Pa. I Will confirm shortly if it compiles

On Jun 7, 2015, at 16:21, Elias Karakoulakis [email protected] wrote:

OK, I've tried using OZW's getValueAsString to get the float values back as strings. It should compile now. Do you have any temperature sensors (or any zwave device that reports floating point values?)

— Reply to this email directly or view it on GitHub.

VirTERM avatar Jun 07 '15 22:06 VirTERM

This is what we have now:

../src/openzwave-driver.cc: In function ‘void OZW::Connect(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:33: error: invalid conversion from ‘void ()(uv_async_t, int)’ to ‘void ()(uv_async_t)’ ../src/openzwave-driver.cc:33: error: initializing argument 3 of ‘int uv_async_init(uv_loop_t_, uv_async_t_, void ()(uv_async_t))’ ../src/openzwave-driver.cc:35: error: no matching function for call to ‘v8::PersistentBasev8::Object::New(v8::Localv8::Object)’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/deps/v8/include/v8.h:572: note: candidates are: static T* v8::PersistentBase::New(v8::Isolate_, T_) [with T = v8::Object] ../src/openzwave-driver.cc:42: error: no matching function for call to ‘MakeCallback(v8::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >&, const char [5], int, v8::Handlev8::Value [1])’ /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:119: note: candidates are: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, const char_, int, v8::Handlev8::Value_) /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:125: note: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, v8::Handlev8::String, int, v8::Handlev8::Value_) /usr/local/lib/node_modules/openzwave-shared/.node-gyp/0.12.4/src/node.h:131: note: v8::Handlev8::Value node::MakeCallback(v8::Isolate_, v8::Handlev8::Object, v8::Handlev8::Function, int, v8::Handlev8::Value_) ../src/openzwave-driver.cc: In function ‘void OZW::BeginControllerCommand(const v8::FunctionCallbackInfov8::Value&)’: ../src/openzwave-driver.cc:130: warning: ‘bool OpenZWave::Manager::BeginControllerCommand(uint32, OpenZWave::Driver::ControllerCommand, void ()(OpenZWave::Driver::ControllerState, OpenZWave::Driver::ControllerError, void), void_, bool, uint8, uint8)’ is deprecated (declared at /usr/local/include/openzwave/Manager.h:1640) make: *** [Release/obj.target/openzwave_shared/src/openzwave-driver.o] Error 1

On Jun 7, 2015, at 6:01 PM, WMT [email protected] wrote:

Yes, i do but i Will be ale to test it tomorrow afternoon EST... Thanks Wojtek Pa. I Will confirm shortly if it compiles

On Jun 7, 2015, at 16:21, Elias Karakoulakis <[email protected] mailto:[email protected]> wrote:

OK, I've tried using OZW's getValueAsString to get the float values back as strings. It should compile now. Do you have any temperature sensors (or any zwave device that reports floating point values?)

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-109797068.

VirTERM avatar Jun 07 '15 22:06 VirTERM

Oh no, its the callback API.... it has changed too (has ANYTHING remained the same between 0.10 and 0.12???) I would understand breaking the API between major versions, but Node.js's versioning scheme is... outright ridiculous!

ekarak avatar Jun 08 '15 04:06 ekarak

uh-oh, all calls to MakeCallback have to be changed!

ekarak avatar Jun 08 '15 05:06 ekarak

ok I've managed to set up a 0.12.4 working environment, and get all necessary changes to get the full NaN goodness baked in and the source now successfully compiles against both 0.12.4 AND 0.10.25. Could you please give it a shot? - but have a fire extinguisher at close range :)

ekarak avatar Jun 12 '15 19:06 ekarak

No need for fire extinguisher ;); compiled just fine, thank You

I will do some testing over the weekend

On Jun 12, 2015, at 3:08 PM, Elias Karakoulakis [email protected] wrote:

ok I've managed to set up a 0.12.4 working environment, and get all necessary changes to get the full NaN goodness baked in and the source now successfully compiles against both 0.12.4 AND 0.10.25. Could you please give it a shot? - but have a fire extinguisher at close range :)

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-111591130.

VirTERM avatar Jun 12 '15 19:06 VirTERM

I just tried adding it to node-red, so I installed node-red-control-openzwave with dependency disabled, however on startup I get: [warn] [zwave] Error: /usr/local/lib/node_modules/openzwave-shared/build/Release/openzwave_shared.node: undefined symbol: _ZN3OZW3OZW10EnablePollERKN2v820FunctionCallbackInfoINS1_5ValueEEE

On Jun 12, 2015, at 3:08 PM, Elias Karakoulakis [email protected] wrote:

ok I've managed to set up a 0.12.4 working environment, and get all necessary changes to get the full NaN goodness baked in and the source now successfully compiles against both 0.12.4 AND 0.10.25. Could you please give it a shot? - but have a fire extinguisher at close range :)

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-111591130.

VirTERM avatar Jun 12 '15 20:06 VirTERM

It was a silly namespace issue. Module now boots up correctly:

$ node test.js loading up RELEASE addon: /home/ekarak/src/node-openzwave-shared/lib/../build/Release/openzwave_shared.node Could Not Open OZW Log File. 2015-06-13 00:20:18.648 Error, Cannot find a path to the configuration files at /home/ekarak/src/node-openzwave-shared/lib/../deps/open-zwave/config/, Using /usr/local/etc/openzwave/ instead... 2015-06-13 00:20:18.648 Info, Reading /usr/local/etc/openzwave/options.xml for Options 2015-06-13 00:20:18.649 Warning, Failed to Parse options.xml: Failed to open file 2015-06-13 00:20:18.649 Always, OpenZwave Version 1.3.938 Starting Up 2015-06-13 00:20:18.649 Info, mgr, Added driver for controller /dev/ttyUSB0 2015-06-13 00:20:18.649 Info, Opening controller /dev/ttyUSB0

Although I havent even addressed the missing prototype copied methods issue, you should be able to invoke the addon directly (eg "zwave.addon.")

Can you git pull and retry?

ekarak avatar Jun 12 '15 21:06 ekarak

I loads properly 12 Jun 17:28:03 - [info] Node-RED version: v0.10.6 12 Jun 17:28:03 - [info] Node.js version: v0.12.4 12 Jun 17:28:03 - [info] Loading palette nodes booting up node-red-contrib-openzwave loading up RELEASE addon: /usr/local/lib/node_modules/openzwave-shared/lib/../build/Release/openzwave_shared.node

Thank You

On Jun 12, 2015, at 5:23 PM, Elias Karakoulakis [email protected] wrote:

It was a silly namespace issue. Module now boots up correctly:

$ node test.js loading up RELEASE addon: /home/ekarak/src/node-openzwave-shared/lib/../build/Release/openzwave_shared.node Could Not Open OZW Log File. 2015-06-13 00:20:18.648 Error, Cannot find a path to the configuration files at /home/ekarak/src/node-openzwave-shared/lib/../deps/open-zwave/config/, Using /usr/local/etc/openzwave/ instead... 2015-06-13 00:20:18.648 Info, Reading /usr/local/etc/openzwave/options.xml for Options 2015-06-13 00:20:18.649 Warning, Failed to Parse options.xml: Failed to open file 2015-06-13 00:20:18.649 Always, OpenZwave Version 1.3.938 Starting Up 2015-06-13 00:20:18.649 Info, mgr, Added driver for controller /dev/ttyUSB0 2015-06-13 00:20:18.649 Info, Opening controller /dev/ttyUSB0

Although I havent even addressed the missing prototype copied methods issue, you should be able to invoke the addon directly (eg "zwave.addon.")

Can you git pull and retry?

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-111621974.

VirTERM avatar Jun 12 '15 21:06 VirTERM

...but its not working. MakeCallback() signature has changed and its clearly passing something other than a function..: ```node: ../src/node.cc:1104: v8::Handlev8::Value node::MakeCallback(node::Environment*, v8::Handlev8::Object, v8::Handlev8::String, int, v8::Handlev8::Value*): Assertion`cb_v->IsFunction()' failed. Ακυρώθηκε (core dumped)

ekarak avatar Jun 13 '15 14:06 ekarak

oh, did not get that far, so I will wait for u now

On Jun 13, 2015, at 10:36 AM, Elias Karakoulakis [email protected] wrote:

...but its not working. MakeCallback() signature has changed and its clearly passing something other than a function..: ``node: ../src/node.cc:1104: v8::Handlev8::Value node::MakeCallback(node::Environment_, v8::Handlev8::Object, v8::Handlev8::String, int, v8::Handlev8::Value_): Assertioncb_v->IsFunction()' failed. Ακυρώθηκε (core dumped)

— Reply to this email directly or view it on GitHub https://github.com/OpenZWave/node-openzwave-shared/issues/2#issuecomment-111714355.

VirTERM avatar Jun 13 '15 15:06 VirTERM