mmdevries / eiows

Other
78 stars 4 forks source link

Error while building (build-log): no matching constructor for initialization of 'String::Utf8Value' #6

Closed ghost closed 3 years ago

ghost commented 3 years ago

Node v12.19.0 NPM v6.14.8 OS: FreeBSD 12.2-RELEASE

Build log:

gmake: Wejście do katalogu '/usr/home/user/projects_dir/myproject/node_modules/eiows/build'
  CXX(target) Release/obj.target/eiows/nodejs/src/addon.o
In file included from ../nodejs/src/addon.cpp:2:
../nodejs/src/addon.h:127:47: error: no matching constructor for initialization of 'String::Utf8Value'
            utf8Value = new (utf8ValueMemory) String::Utf8Value(isolate, value);
                                              ^                 ~~~~~~~~~~~~~~
/home/user/.cache/node-gyp/6.9.1/include/node/v8.h:2428:14: note: candidate constructor not viable: requires single argument 'obj', but 2 arguments were provided
    explicit Utf8Value(Local<v8::Value> obj);
             ^
/home/user/.cache/node-gyp/6.9.1/include/node/v8.h:2438:5: note: candidate constructor not viable: requires 1 argument, but 2 were provided
    Utf8Value(const Utf8Value&);
    ^
In file included from ../nodejs/src/addon.cpp:2:
../nodejs/src/addon.h:215:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    array->Set(isolate->GetCurrentContext(), 0, Integer::New(isolate, address.port));
    ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:216:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    array->Set(isolate->GetCurrentContext(), 1, String::NewFromUtf8(isolate, address.address, NewStringType::kNormal).ToLocalChecked());
    ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:217:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    array->Set(isolate->GetCurrentContext(), 2, String::NewFromUtf8(isolate, address.family,  NewStringType::kNormal).ToLocalChecked());
    ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:241:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        Local<Function>::New(sc->isolate, sc->jsCallback)->Call(sc->isolate->GetCurrentContext(), Null(sc->isolate), 0, nullptr);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:327:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        Local<Function>::New(isolate, *connectionCallback)->Call(isolate->GetCurrentContext(), Null(isolate), 1, argv);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:344:13: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
            Local<Function>::New(isolate, *messageCallback)->Call(isolate->GetCurrentContext(), Null(isolate), 2, argv);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:339:49: warning: lambda capture 'group' is not used [-Wunused-lambda-capture]
    group->onMessage([isolate, messageCallback, group](eioWS::WebSocket *webSocket, const char *message, size_t length, eioWS::OpCode opCode) {
                                              ~~^~~~~
../nodejs/src/addon.h:364:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        Local<Function>::New(isolate, *disconnectionCallback)->Call(isolate->GetCurrentContext(), Null(isolate), 4, argv);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.h:416:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        object->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "group", NewStringType::kNormal).ToLocalChecked(), group);
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nodejs/src/addon.cpp:7:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "server", NewStringType::kNormal).ToLocalChecked(), Namespace(isolate).object);
    ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 warnings and 1 error generated.
gmake: *** [eiows.target.mk:102: Release/obj.target/eiows/nodejs/src/addon.o] Błąd 1
gmake: Opuszczenie katalogu '/usr/home/user/projects_dir/myproject/node_modules/eiows/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System FreeBSD 12.2-RELEASE
gyp ERR! command "/usr/home/user/.nvm/versions/node/v6.9.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/user/projects_dir/myproject/node_modules/eiows
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
mmdevries commented 3 years ago

It seems more like an environment issue to me. Are you sure that you don't have compiled this on node version v6.9.1 instead of 12.19.0? This is at least what the log is telling as well. gyp ERR! node -v v6.9.1 BTW this module is not supported on node 6.

ghost commented 3 years ago

I'm not sure how node-gyp works and co-releate with whole node.js system. I've tried to update it separatelly, but as I see in ur post, node-gyp is updated when node is updated?

In my shared hosting I have configuration that uses two node versions

node --version //shows v6.9.1
node12 --version //shows v12.19.0

there is also npm and npm12 command

I've installed eiows by using npm12 install --save eiows so I was expecting everything would be compiled for node v12, but now I think it wont be.

Is there some way to instruct eiows installation to use npm12 command instead of regular npm and coresponding node-gyp?

mmdevries commented 3 years ago

I’m afraid I cannot help you with that. I think it depends on your environment variable which node version is used/found. You can use nvm for instance to manipulate this but there are no prebuild binaries on freeBSD so it will take a while to build the nodejs version you want to use.

ghost commented 3 years ago

I've just did installation through NVM of latest LTS Node.js version along with NPM, previously it wasn't possible on my hosting, now it is and I've installed eiows successfully. Thanks for help!

mmdevries commented 3 years ago

Great, you are welcome.