brainpicture / hashlib

lib for node which makes hashes
nodejs.ru
165 stars 35 forks source link

hashlib 1.0.1 not installing on OSX 10.7 #29

Open EnriqueVidal opened 12 years ago

EnriqueVidal commented 12 years ago

I was able to install hashlib on Snow Leopard but in Lion this is the output I see:

> hashlib@1.0.1 preinstall /Users/enrique/Desktop/hubot/node_modules/hashlib
> node-waf clean || true; node-waf configure build

Nothing to clean (project not configured)
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for gcc                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /opt/local 
'configure' finished successfully (0.126s)
Waf: Entering directory `/Users/enrique/Desktop/hubot/node_modules/hashlib/build'
[1/6] cc: libhash/md4c.c -> build/Release/libhash/md4c_1.o
[2/6] cc: libhash/md5c.c -> build/Release/libhash/md5c_1.o
[3/6] cc: libhash/sha0c.c -> build/Release/libhash/sha0c_1.o
[4/6] cxx: hashlib.cc -> build/Release/hashlib_2.o
../hashlib.cc:14:16: error: ev.h: No such file or directory
../hashlib.cc:15:17: error: eio.h: No such file or directory
../hashlib.cc:311: error: ‘eio_req’ was not declared in this scope
../hashlib.cc:311: error: ‘req’ was not declared in this scope
../hashlib.cc:312: error: expected ‘,’ or ‘;’ before ‘{’ token
Waf: Leaving directory `/Users/enrique/Desktop/hubot/node_modules/hashlib/build'
Build failed:  -> task failed (err #1): 
    {task: cxx hashlib.cc -> hashlib_2.o}
npm ERR! error installing hashlib@1.0.1 Error: hashlib@1.0.1 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing hashlib@1.0.1 `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! error installing hashlib@1.0.1     at ChildProcess.<anonymous> (/opt/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing hashlib@1.0.1     at ChildProcess.emit (events.js:70:17)
npm ERR! error installing hashlib@1.0.1     at maybeExit (child_process.js:359:16)
npm ERR! error installing hashlib@1.0.1     at Process.onexit (child_process.js:395:5)
npm ERR! hashlib@1.0.1 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the hashlib@1.0.1 preinstall script.
npm ERR! This is most likely a problem with the hashlib package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf clean || true; node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls hashlib
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/opt/local/bin/npm" "install"
npm ERR! cwd /Users/enrique/Desktop/hubot
npm ERR! node -v v0.6.5
npm ERR! npm -v 1.0.106
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/enrique/Desktop/hubot/npm-debug.log
npm not ok
EnriqueVidal commented 12 years ago

I did notice Checking for node path: not found but node is installed and no other npm package complains. Please advise.

BadKnees commented 12 years ago

quickfix: sudo ln -sf /usr/local/include/node/node.h /usr/local/include/node/ev.h CXXFLAGS=-I/usr/local/include/node/uv-private/ npm install hashlib

It compiles, but when i require('hashlib') i get cannot find module 'hashlib' - so there is something missing.

BadKnees commented 12 years ago

ahh, full path:

var hashlib = require('./node_modules/hashlib/build/Release/hashlib');

Now it works

EnriqueVidal commented 12 years ago

Where do I set that variable?

BadKnees commented 12 years ago

Which variable? If you mean the first post you can paste those two lines in you terminal. The first one will make a link from node to ev.h as ev.h is now gone and everything is in node.h. And the second sets an environmen variable for npm so the compiler can find the other sources.

If you mean the second post, it's in your project. e.g app.js or something

rogersm commented 12 years ago

Remember to do the same with eio.h:

# sudo ln -sf /usr/local/include/node/node.h /usr/local/include/node/eio.h

and copy it to the root file:

# cp ./build/Release/hashlib.node ~/.node_libraries/hashlib.node
ssokol1971 commented 12 years ago

You can drop the long path if you go into the package.json file and swap "Release" in place of "Default" in the main and directories entries.

  "main": "build/Release/hashlib",
  "directories": {
    "lib": "./build/Release"
  },