Node 0.8.0, OSX, bcrypt installs but won't load, wrong architecture #84

Closed
kylecordes opened this Issue Jun 26, 2012 · 9 comments

Projects

None yet

3 participants

@kylecordes

I'm running the fresh new Node 0.8.0, OSX 10.7; I also tested with Node 0.8.0 on OSX 10.6, with the same results. On both OSXs, I used the 0.8.0 installer from nodejs.org.

$ npm --version
1.1.32

"npm bcrypt install" works, with a compiler warning or two. But when require()ing it, this happens:

module.js:480
process.dlopen(filename, module.exports);
^
Error: dlopen(/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build/Release/bcrypt_lib.node, 1): no suitable image found. Did find:
/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build/Release/bcrypt_lib.node: mach-o, but wrong architecture
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/bcrypt.js:5:18)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

It appears that the build for bcrypt succeeds (or at least, doesn't fail), but also does't yield a working binary / module

@kylecordes

I forgot to mention above, that it is all OK on older Nodes, like 0.6.19.

@ncb000gt
Owner

Need to rebuild. Try clearing your npm cache or removing the node_modules/bcrypt directory in your project.

@kylecordes

It was a fresh build; before entering an issue here I completely wiped all Node, NPM, and modules, and started fresh. I just now rm-rf'ed node_modules (also verifying there are none globally installed), and verified it again. It is as rebuilt as it could be.

By the way, I get a few warnings during the build, pasted below.

Waf: Entering directory `/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build'
[1/4] cxx: src/blowfish.cc -> build/Release/src/blowfish_1.o
[2/4] cxx: src/bcrypt.cc -> build/Release/src/bcrypt_1.o
[3/4] cxx: src/bcrypt_node.cc -> build/Release/src/bcrypt_node_1.o
../src/bcrypt_node.cc: In function ‘void crypto_lock_init()’:
../src/bcrypt_node.cc:87: warning: ‘CRYPTO_num_locks’ is deprecated (declared at /usr/include/openssl/crypto.h:415)
../src/bcrypt_node.cc:87: warning: ‘CRYPTO_num_locks’ is deprecated (declared at /usr/include/openssl/crypto.h:415)
../src/bcrypt_node.cc: In function ‘int<unnamed>::GetSeed(uint8_t*, int)’:
../src/bcrypt_node.cc:141: warning: ‘RAND_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:104)
../src/bcrypt_node.cc:141: warning: ‘RAND_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:104)
../src/bcrypt_node.cc:144: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)
../src/bcrypt_node.cc:144: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)
../src/bcrypt_node.cc: In function ‘void init(v8::Handle<v8::Object>)’:
../src/bcrypt_node.cc:479: warning: ‘CRYPTO_set_locking_callback’ is deprecated (declared at /usr/include/openssl/crypto.h:418)
../src/bcrypt_node.cc:479: warning: ‘CRYPTO_set_locking_callback’ is deprecated (declared at /usr/include/openssl/crypto.h:418)
../src/bcrypt_node.cc:480: warning: ‘CRYPTO_set_id_callback’ is deprecated (declared at /usr/include/openssl/crypto.h:425)
../src/bcrypt_node.cc:480: warning: ‘CRYPTO_set_id_callback’ is deprecated (declared at /usr/include/openssl/crypto.h:425)
[4/4] cxx_link: build/Release/src/blowfish_1.o build/Release/src/bcrypt_1.o build/Release/src/bcrypt_node_1.o -> build/Release/bcrypt_lib.node
Waf: Leaving directory `/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build'
'build' finished successfully (0.672s)
@dhruv-bhatia

+1 Exact same issue here on OS X 10.7.4.

@ncb000gt
Owner

I have 10.7.4 right now as well.

I recompiled everything and got the same warnings you described. However, I was also able to run the test suite without any issues.

Are you able to run the tests within the module directory after running make build?

@kylecordes

No. Much like my own code (which fails as soon as it require(bcrypt), the bcrypt tests also fail the same was, when they try to load bcrypt. Snippet below:

'build' finished successfully (0.612s)

module.js:480
  process.dlopen(filename, module.exports);
          ^
Error: dlopen(/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build/Release/bcrypt_lib.node, 1): no suitable image found.  Did find:
    /Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/build/Release/bcrypt_lib.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:480:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/kcordes/Documents/workspace/cerb1/node_modules/bcrypt/bcrypt.js:5:18)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
make: *** [test] Error 1
@ncb000gt
Owner

I've just published an update to NPM that uses gyp instead of waf. Give it a try and let me know.

Thanks.

@kylecordes

Thank you. Your new version 0.6.0 now builds cleanly, passes its tests, and works.

@ncb000gt
Owner

Great to hear. I suspected the issue was related to appropriare linking. GYP takes care of a lot of the tedious stuff. :)

@ncb000gt ncb000gt closed this Jun 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment