Fails to build on node 0.12+
admorphit opened this issue · comments
Looks like npm install phash
fails on latest version of node 0.12
with the following errors- any chance to get this working for the latest version of node?
> node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/pHash/phash.o
../phash.cpp:12:5: error: unknown type name 'uv_work_t'
uv_work_t request;
^
../phash.cpp:48:17: error: unknown type name 'uv_work_t'
void HashWorker(uv_work_t* req) {
^
../phash.cpp:53:16: error: unknown type name 'uv_work_t'
void HashAfter(uv_work_t* req, int status) {
^
../phash.cpp:54:17: error: calling a protected constructor of class 'v8::HandleScope'
HandleScope scope;
^
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: note: declared protected here
V8_INLINE HandleScope() {}
^
../phash.cpp:60:27: error: no member named 'New' in 'v8::String'
argv[0] = String::New("Error getting image hash");
~~~~~~~~^
../phash.cpp:63:19: error: no matching function for call to 'Undefined'
argv[0] = Undefined();
^~~~~~~~~
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
friend Handle<Primitive> Undefined(Isolate* isolate);
^
../phash.cpp:66:23: error: no member named 'New' in 'v8::String'
argv[1] = String::New(request->hash.c_str());
~~~~~~~~^
../phash.cpp:67:22: error: member reference type 'Persistent<v8::Function>' is not a pointer; maybe you meant to use '.'?
request->callback->Call(Context::GetCurrent()->Global(), 2, argv);
~~~~~~~~~~~~~~~~~^~
.
../phash.cpp:67:24: error: no member named 'Call' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function> >'
request->callback->Call(Context::GetCurrent()->Global(), 2, argv);
~~~~~~~~~~~~~~~~~ ^
../phash.cpp:67:38: error: no member named 'GetCurrent' in 'v8::Context'
request->callback->Call(Context::GetCurrent()->Global(), 2, argv);
~~~~~~~~~^
../phash.cpp:68:23: error: no member named 'Dispose' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function> >'
request->callback.Dispose();
~~~~~~~~~~~~~~~~~ ^
../phash.cpp:73:36: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
Handle<Value> ImageHashAsync(const Arguments& args) {
^~~~~~~~~
v8::internal::Arguments
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
^
../phash.cpp:74:13: error: member access into incomplete type 'const v8::internal::Arguments'
if (args.Length() < 2 || !args[1]->IsFunction()) {
^
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note: forward declaration of 'v8::internal::Arguments'
class Arguments;
^
../phash.cpp:76:56: error: no member named 'New' in 'v8::String'
return ThrowException(Exception::Error(String::New("Callback is required and must be an Function.")));
~~~~~~~~^
../phash.cpp:79:31: error: type 'const v8::internal::Arguments' does not provide a subscript operator
String::Utf8Value str(args[0]);
~~~~^~
../phash.cpp:80:54: error: type 'const v8::internal::Arguments' does not provide a subscript operator
Handle<Function> cb = Handle<Function>::Cast(args[1]);
~~~~^~
../phash.cpp:83:47: error: 'New' is a private member of 'v8::PersistentBase<v8::Function>'
request->callback = Persistent<Function>::New(cb);
^
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:572:23: note: declared private here
V8_INLINE static T* New(Isolate* isolate, T* that);
^
../phash.cpp:83:53: error: too few arguments to function call, expected 2, have 1
request->callback = Persistent<Function>::New(cb);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8.h:572:3: note: 'New' declared here
V8_INLINE static T* New(Isolate* isolate, T* that);
^
/Users/user/.node-gyp/0.12.0/deps/v8/include/v8config.h:289:20: note: expanded from macro 'V8_INLINE'
# define V8_INLINE inline __attribute__((always_inline))
^
../phash.cpp:86:19: error: use of undeclared identifier 'uv_default_loop'
uv_queue_work(uv_default_loop(), &request->request, HashWorker, HashAfter);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
I'm working on this -- you can track the progress here:
https://github.com/aaronm67/node-phash/tree/feature/node-.12-compatibility
Need to switch over to using Nan due to some API changes in v8.
if you're looking for a version that works with all recent versions of node/iojs: https://github.com/mgmtio/phash-image
Does phash-image
depends on phash
???
$ npm install --save phash-image
> phash-image@3.3.0 install /home/msolari/apps/escrape2/node_modules/phash-image
> node-gyp rebuild
Package pHash was not found in the pkg-config search path.
Perhaps you should add the directory containing `pHash.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pHash' found
...
Should work once this merged #24