node-sane
node-sane copied to clipboard
Node-gyp build failure
Hello,
I'm trying to run your example project, however, on npm install
I encounter the following node-gyp
error:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
sane.cc
sane_device.cc
sane_handle.cc
sane_option_descriptor.cc
c:\users\samir\sites\tests\testy\node_modules\node-sane\src\sane_option_descriptor.h(4): fatal error C1083: Ca nnot open include file: 'sane/sane.h': No such file or directory (compiling source file ..\src\sane_option_des criptor.cc) [C:\Users\Samir\Sites\tests\testy\node_modules\node-sane\build\node-sane.vcxproj]
c:\users\samir\sites\tests\testy\node_modules\node-sane\src\sane_handle.h(4): fatal error C1083: Cannot open i nclude file: 'sane/sane.h': No such file or directory (compiling source file ..\src\sane_handle.cc) [C:\Users\ Samir\Sites\tests\testy\node_modules\node-sane\build\node-sane.vcxproj]
sane_parameters.cc
win_delay_load_hook.cc
c:\users\samir\sites\tests\testy\node_modules\node-sane\src\sane_device.h(4): fatal error C1083: Cannot open i nclude file: 'sane/sane.h': No such file or directory (compiling source file ..\src\sane_device.cc) [C:\Users\ Samir\Sites\tests\testy\node_modules\node-sane\build\node-sane.vcxproj]
c:\users\samir\sites\tests\testy\node_modules\node-sane\src\sane_parameters.h(4): fatal error C1083: Cannot op en include file: 'sane/sane.h': No such file or directory (compiling source file ..\src\sane_parameters.cc) [C :\Users\Samir\Sites\tests\testy\node_modules\node-sane\build\node-sane.vcxproj]
..\src\sane.cc(3): fatal error C1083: Cannot open include file: 'arpa/inet.h': No such file or directory [C:\U sers\Samir\Sites\tests\testy\node_modules\node-sane\build\node-sane.vcxproj]
I see that this project hasn't been updated for quite some time now. Could this be the issue? Is there any way to use it with Node 7 or 8 ?
Thank you.
Hey there,
Unfortunately, I think libsane
is not supported on Windows :disappointed: Windows uses WIA to access scanners, and this library doesn't support that at the moment.
I tested it on Ubuntu Linux 16.04 LTS with libsane-dev
installed and it does work with Node 8.1.0.
@yjwong Thank you for the explanation. Would you know any such library that would work on Windowss? I absolutely have to access a scanner through an Electron app, do you have any lead or pointers?
Again, thank you.
Hi, I'm attempting to use this library with the latest versions of node, I'm getting a lot of node-gyp errors (12.10.0), mostly occurring in sane.cc, but also some in nan.h. There's a 404 error for the prebuilt binary from amazonaws. Could you update the project, provide another prebuilt link (Github builds?) or let me know of the versions I need to built this, thanks!
I get a whole host of this kind of stuff:
../src/sane.cc:427:38: error: expected primary-expression before ‘]’ token
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^
../src/sane.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE GetParameters(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/sane.cc:426:61: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Local<Function> paramsFunc = paramsTpl->GetFunction();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:5961:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:5961:46: note: candidate expects 1 argument, 0 provided
../src/sane.cc:427:9: error: ‘Handle’ was not declared in this scope
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^~~~~~
../src/sane.cc: In member function ‘virtual void ReadWorker::HandleOKCallback()’:
../src/sane.cc:470:52: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
Local<Object> object = result->NewInstance();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate: v8::MaybeLocal<v8::Object> v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
^~~~~~~~~~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate expects 1 argument, 0 provided
../src/sane.cc:471:74: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("status").ToLocalChecked(), Nan::New(status));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:474:75: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("length").ToLocalChecked(), Nan::New(len));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:478:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
callback->Call(1, argv);
^
In file included from ../src/sane_device.h:6:0,
from ../src/sane.cc:8:
../node_modules/nan/nan.h:1740:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/sane.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE ReadSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/sane.cc:540:53: error: no matching function for call to ‘v8::ObjectTemplate::New()’
Local<ObjectTemplate> result = ObjectTemplate::New();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6249:32: note: candidate: static v8::Local<v8::ObjectTemplate> v8::ObjectTemplate::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)
static Local<ObjectTemplate> New(
^~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6249:32: note: candidate expects 2 arguments, 0 provided
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6428:32: note: candidate: static v8::Local<v8::ObjectTemplate> v8::ObjectTemplate::New(v8::internal::Isolate*, v8::Local<v8::FunctionTemplate>)
static Local<ObjectTemplate> New(internal::Isolate* isolate,
^~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6428:32: note: candidate expects 2 arguments, 0 provided
../src/sane.cc:541:45: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
Local<Object> object = result->NewInstance();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate: v8::MaybeLocal<v8::Object> v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
^~~~~~~~~~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate expects 1 argument, 0 provided
../src/sane.cc:542:67: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("status").ToLocalChecked(), Nan::New(status));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:543:64: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("length").ToLocalChecked(), Nan::New(len));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc: In member function ‘virtual void CancelWorker::HandleOKCallback()’:
../src/sane.cc:560:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
callback->Call(0, argv);
^
In file included from ../src/sane_device.h:6:0,
from ../src/sane.cc:8:
../node_modules/nan/nan.h:1740:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/sane.cc:427:9: note: suggested alternative: ‘handle’
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^~~~~~
handle
../src/sane.cc:427:21: error: expected primary-expression before ‘>’ token
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^
../src/sane.cc:427:23: error: ‘paramsFuncArgs’ was not declared in this scope
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^~~~~~~~~~~~~~
../src/sane.cc: At global scope:
../src/sane.cc:640:14: error: variable or field ‘InitAll’ declared void
void InitAll(Handle<Object> exports) {
^~~~~~
../src/sane.cc:640:14: error: ‘Handle’ was not declared in this scope
../src/sane.cc:640:14: note: suggested alternative: ‘rand_r’
void InitAll(Handle<Object> exports) {
^~~~~~
rand_r
../src/sane.cc:640:27: error: expected primary-expression before ‘>’ token
void InitAll(Handle<Object> exports) {
^
../src/sane.cc:640:29: error: ‘exports’ was not declared in this scope
void InitAll(Handle<Object> exports) {
^~~~~~~
../src/sane.cc:427:23: note: suggested alternative: ‘paramsFunc’
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^~~~~~~~~~~~~~
paramsFunc
../src/sane.cc:427:38: error: expected primary-expression before ‘]’ token
Handle<Value> paramsFuncArgs[] = { Nan::New<External>(parameters) };
^
In file included from ../src/sane.cc:4:0:
../src/sane.cc:669:19: error: ‘InitAll’ was not declared in this scope
NODE_MODULE(sane, InitAll)
^
/home/vxn/.node-gyp/12.10.0/include/node/node.h:560:36: note: in definition of macro ‘NODE_MODULE_X’
(node::addon_register_func) (regfunc), \
^~~~~~~
../src/sane.cc:669:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(sane, InitAll)
^~~~~~~~~~~
../src/sane.cc:669:19: note: suggested alternative: ‘Init’
NODE_MODULE(sane, InitAll)
^
/home/vxn/.node-gyp/12.10.0/include/node/node.h:560:36: note: in definition of macro ‘NODE_MODULE_X’
(node::addon_register_func) (regfunc), \
^~~~~~~
../src/sane.cc:669:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(sane, InitAll)
^~~~~~~~~~~
../src/sane.cc: In member function ‘virtual void ReadWorker::HandleOKCallback()’:
../src/sane.cc:470:52: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
Local<Object> object = result->NewInstance();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate: v8::MaybeLocal<v8::Object> v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
^~~~~~~~~~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate expects 1 argument, 0 provided
../src/sane.cc:471:74: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("status").ToLocalChecked(), Nan::New(status));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:474:75: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("length").ToLocalChecked(), Nan::New(len));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:478:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
callback->Call(1, argv);
^
In file included from ../src/sane_device.h:6:0,
from ../src/sane.cc:8:
../node_modules/nan/nan.h:1740:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/sane.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE ReadSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/sane.cc:540:53: error: no matching function for call to ‘v8::ObjectTemplate::New()’
Local<ObjectTemplate> result = ObjectTemplate::New();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6249:32: note: candidate: static v8::Local<v8::ObjectTemplate> v8::ObjectTemplate::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)
static Local<ObjectTemplate> New(
^~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6249:32: note: candidate expects 2 arguments, 0 provided
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6428:32: note: candidate: static v8::Local<v8::ObjectTemplate> v8::ObjectTemplate::New(v8::internal::Isolate*, v8::Local<v8::FunctionTemplate>)
static Local<ObjectTemplate> New(internal::Isolate* isolate,
^~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6428:32: note: candidate expects 2 arguments, 0 provided
../src/sane.cc:541:45: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
Local<Object> object = result->NewInstance();
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63:0,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate: v8::MaybeLocal<v8::Object> v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
^~~~~~~~~~~
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:6258:44: note: candidate expects 1 argument, 0 provided
../src/sane.cc:542:67: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("status").ToLocalChecked(), Nan::New(status));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc:543:64: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
object->Set(Nan::New("length").ToLocalChecked(), Nan::New(len));
^
In file included from /home/vxn/.node-gyp/12.10.0/include/node/v8-internal.h:14:0,
from /home/vxn/.node-gyp/12.10.0/include/node/v8.h:25,
from /home/vxn/.node-gyp/12.10.0/include/node/node.h:63,
from ../src/sane.cc:4:
/home/vxn/.node-gyp/12.10.0/include/node/v8.h:3372:22: note: declared here
bool Set(Local<Value> key, Local<Value> value));
^
/home/vxn/.node-gyp/12.10.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/sane.cc: In member function ‘virtual void CancelWorker::HandleOKCallback()’:
../src/sane.cc:560:31: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
callback->Call(0, argv);
^
In file included from ../src/sane_device.h:6:0,
from ../src/sane.cc:8:
../node_modules/nan/nan.h:1740:3: note: declared here
Call(int argc, v8::Local<v8::Value> argv[]) const {
^~~~
../src/sane.cc: At global scope:
../src/sane.cc:640:14: error: variable or field ‘InitAll’ declared void
void InitAll(Handle<Object> exports) {
^~~~~~
../src/sane.cc:640:14: error: ‘Handle’ was not declared in this scope
../src/sane.cc:640:14: note: suggested alternative: ‘rand_r’
void InitAll(Handle<Object> exports) {
^~~~~~
rand_r
../src/sane.cc:640:27: error: expected primary-expression before ‘>’ token
void InitAll(Handle<Object> exports) {
^
../src/sane.cc:640:29: error: ‘exports’ was not declared in this scope
void InitAll(Handle<Object> exports) {
^~~~~~~
In file included from ../src/sane.cc:4:0:
../src/sane.cc:669:19: error: ‘InitAll’ was not declared in this scope
NODE_MODULE(sane, InitAll)
^
/home/vxn/.node-gyp/12.10.0/include/node/node.h:560:36: note: in definition of macro ‘NODE_MODULE_X’
(node::addon_register_func) (regfunc), \
^~~~~~~
../src/sane.cc:669:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(sane, InitAll)
^~~~~~~~~~~
../src/sane.cc:669:19: note: suggested alternative: ‘Init’
NODE_MODULE(sane, InitAll)
^
/home/vxn/.node-gyp/12.10.0/include/node/node.h:560:36: note: in definition of macro ‘NODE_MODULE_X’
(node::addon_register_func) (regfunc), \
^~~~~~~
../src/sane.cc:669:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(sane, InitAll)
^~~~~~~~~~~
node-saner.target.mk:116: recipe for target 'Release/obj.target/node-saner/src/sane.o' failed
make: *** [Release/obj.target/node-saner/src/sane.o] Error 1