node-pcsc icon indicating copy to clipboard operation
node-pcsc copied to clipboard

nw-gyp compillation

Open VladislavAnkudinov opened this issue 10 years ago • 11 comments

I have an error when trying to compile with nw-gyp rather then node-gyp "CIL library ( CIL module *) : error LNK2005: "public: class v8::Local<class v8::Value> __thiscall ... ... alerady defined in nw.lib(nw.exe)

whats goin on? is it some headers included two times?

VladislavAnkudinov avatar Apr 18 '14 15:04 VladislavAnkudinov

Hi, it seems that the problem is in your nw.lib (node webkit lib if I'm right?), I've never tried to use nw-gyp and I'm not planning to support it any time soon. Did you tried to compile node-pcsc using node-gyp ? I did all my tests on a Linux machine, compilation may fail on windows, we can manage to fix it together if you want.

jokesterfr avatar Apr 24 '14 09:04 jokesterfr

my module should work on client side thats why i use node-webkit and nw-gyp rather then node-gyp (node-webkit and node use diffrend ABI). The problem was in header files. If put #include <node.h> directly in sources but not in headers it compiles well with node-gyp and nw-gyp. It looks like some linker settings can be changed to achive same result but i dont know much about cpp linkers and dont have such solution. May be Ludovic can advise something^^?

VladislavAnkudinov avatar Apr 24 '14 10:04 VladislavAnkudinov

I also cant compile with nw-gyp

../src/common.h:13:48: warning: format specifies type 'unsigned long' but the argument has type 'LONG' (aka 'int') [-Wformat] pcsc_stringify_error(result), result); ^~~~~~ ../src/pcsclite.cpp:45:52: warning: comparison of integers of different signs: 'LONG' (aka 'int') and 'unsigned int' [-Wsign-compare] if ((result != SCARD_S_SUCCESS) && (result != SCARD_E_TIMEOUT)) { ~~~~~~ ^ ~~~~~~~~~~~~~~~ ../src/pcsclite.cpp:155:20: warning: comparison of integers of different signs: 'LONG' (aka 'int') and 'unsigned int' [-Wsign-compare] if (result == SCARD_E_NO_READERS_AVAILABLE) { ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 warnings generated. CXX(target) Release/obj.target/pcsclite/src/cardreader.o In file included from ../src/cardreader.cpp:2: ../src/common.h:13:48: warning: format specifies type 'unsigned long' but the argument has type 'LONG' (aka 'int') [-Wformat] pcsc_stringify_error(result), result);

getting some warnings...

mn1aC avatar Mar 21 '15 17:03 mn1aC

I would like to use the smartcard reader on windows and mac.. (error log above is from mac)

mn1aC avatar Mar 21 '15 17:03 mn1aC

for the record on OSX I get the same errors with node-gyp

mn1aC avatar Mar 21 '15 17:03 mn1aC

Ok compilation worked now.

I had to make a few changes to the .cpp files (I will send them to the creator of this project) I also had to install buffertools with npm in the pcsc folder

mn1aC avatar Mar 21 '15 17:03 mn1aC

The program I am running now on OSX opens up and show's the name of my cardreader and than crashes...

mn1aC avatar Mar 21 '15 17:03 mn1aC

So I guess something is wrong with the C++ code at runtime now.. How could i debug the .cpp code? (I'm not really used to program in this language)

mn1aC avatar Mar 21 '15 17:03 mn1aC

commented some js code now, and It seems after creation var pcsc = pcsc(); the program crashed after a few seconds.

mn1aC avatar Mar 21 '15 18:03 mn1aC

@mn1aC did you pushed any branch I could look at?

jokesterfr avatar Apr 22 '15 09:04 jokesterfr

@mn1aC bump :)

jokesterfr avatar Jan 27 '16 11:01 jokesterfr