build issue with node 4.2.2
Closed this issue · 7 comments
Hello, I was trying to experiment with this module and having some trouble building it. Was wondering if you have some tips on getting my environment right. I currently use nvm to setup node. Here is the error I get when trying to run 'npm install milter':
\
> milter@1.0.0 install /nodeuser/scratch/node_modules/milter
> node-gyp rebuild
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
make: Entering directory `/nodeuser/scratch/node_modules/milter/build'
CXX(target) Release/obj.target/milter/src/envelope.o
In file included from ../src/events.h:20:0,
from ../src/envelope.h:13,
from ../src/envelope.cc:8:
../src/milter.h:7:21: fatal error: node/uv.h: No such file or directory
#include <node/uv.h>
^
compilation terminated.
make: *** [Release/obj.target/milter/src/envelope.o] Error 1
make: Leaving directory `/nodeuser/scratch/node_modules/milter/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/nodeuser/.nvm/versions/node/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.10.0-229.1.2.el7.x86_64
gyp ERR! command "/nodeuser/.nvm/versions/node/v4.4.2/bin/node" "/nodeuser/.nvm/versions/node/v4.4.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /nodeuser/scratch/node_modules/milter
gyp ERR! node -v v4.4.2
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.10.0-229.1.2.el7.x86_64
npm ERR! argv "/nodeuser/.nvm/versions/node/v4.4.2/bin/node" "/nodeuser/.nvm/versions/node/v4.4.2/bin/npm" "install" "milter"
npm ERR! node v4.4.2
npm ERR! npm v2.15.0
npm ERR! code ELIFECYCLE
I fixed the aove error by setting my CPATH to the nvm directory.
eg: export CPATH=~/.nvm/versions/node/v4.4.2/include
However, now I encounter this error:
make: Entering directory `/nodeuser/scratch/git/node-milter/build'
CXX(target) Release/obj.target/milter/src/envelope.o
CXX(target) Release/obj.target/milter/src/events.o
../src/events.cc: In member function ‘void MilterEvent::DoFCall(v8::Isolate*, v8::Persistent<v8::Function>&, unsigned int, v8::Local<v8::Value>*)’:
../src/events.cc:165:22: warning: ‘void node::FatalException(const v8::TryCatch&)’ is deprecated (declared at /nodeuser/.node-gyp/4.4.2/include/node/node.h:282): Use FatalException(isolate, ...) [-Wdeprecated-declarations]
FatalException(tc);
^
../src/events.cc: In member function ‘virtual void MilterMessageData::FireWrapper(v8::Isolate*, bindings_t*)’:
../src/events.cc:372:5: error: ‘Use’ is not a member of ‘node::Buffer’
Buffer::Use(isolate, nodebuf, len),
^
make: *** [Release/obj.target/milter/src/events.o] Error 1
make: Leaving directory `/nodeuser/scratch/git/node-milter/build'
gyp ERR! build error
the first error would have been include paths, yes.
the second problem suggests you have a newer version of node which i didn't target; it probably didn't exist yet. this project was written against v0.12.0 iirc.
At the bottom of the README, you seem to hint at this specific error (though I'm not skilled enough with node native coding to truly understand what you meant):
node.js buffers are created during the message data event (the client has already send command "DATA", and now a chunk of the message data has arrived) using the i-suspect-is-soon-to-be-deprecated method Buffer::Use(), which should have been named Buffer::New() like the others, by passing (const unsigned char *) as the expected (char *) which is probably stupid. it is unclear to me why there is no Buffer::New() that simply accepts (void *) like all the real POSIX C buffer- manipulating functions. whatever.
Do you think it's just an easy fix for this one function. If so, I can give it a shot and if it works, I can submit a pull request.
i would merge a PR that modernizes it, yes, if it compiles and passes a simple test or two to your own satisfaction. i don't have a lot of time to work on it myself so contributions are very welcome.
i do think fixing this one thing is going to be easy, yes. however after you've fixed that you're liable to run into other issues, so just be forewarned. i did not use nvm myself when starting the codebase so i don't know what's going to happen.
I was planning to learn about nan. Do you think this would be a good candidate project to migrate to it? Also, out of curiosity, is this being used in production anywhere that you know of?
never heard of it, couldn't tell you.
no absolutely not; it's a pet project of mine. but i do do email, and my company may make commercial use of it in the future.
take the usual precautions re: security, leaks, etc. when bringing it to a commercial environment!
i'm going to close this because its been about a year now. the good news is, v4 and v0.12 are both outdated, so i'm now building and testing against node v7.7.4 and perhaps it works for both of us.