如何在mac OSX上编译node-segfault-handler?

时间:2012-12-21 01:36:20

标签: macos node.js

我正在尝试使用https://github.com/ddopson/node-segfault-handler来调试分段错误异常。我正在运行OSX 10.8.6

但是,在存储库上运行npm rebuild后,我收到以下错误:

node example.js 

module.js:485
  process.dlopen(filename, module.exports);
          ^
Error: dlopen(/Users/xxx/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node, 1): no suitable image found.  Did find:
    /Users/xxx/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:485: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/xxx/lever/ats/node_modules/segvcatcher/lib/segvhandler.js:7:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)

1 个答案:

答案 0 :(得分:0)

我刚测试在“Mac OS X 10.7.5(11G63)”上构建它,它在那里工作正常。我没有任何OSX 10.8.6的盒子来测试它,但我打赌Node版本更重要。

> segvcatcher@0.1.0 install /Users/Dopson/work/other/node-segfault-handler
> node-waf clean ; node-waf configure build

'clean' finished successfully (0.005s)
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 node path                   : ok /Users/Dopson/.node_libraries
Checking for node prefix                 : ok /usr/local/Cellar/node/0.8.18
'configure' finished successfully (0.032s)
Waf: Entering directory `/Users/Dopson/work/other/node-segfault-handler/build'
[1/2] cxx: src/segvhandler.cpp -> build/Release/src/segvhandler_1.o
[2/2] cxx_link: build/Release/src/segvhandler_1.o -> build/Release/segvhandler_native.node
Waf: Leaving directory `/Users/Dopson/work/other/node-segfault-handler/build'
'build' finished successfully (0.214s)

我第一次失败了因为我的node-waf安装被塞了(缺少一个python dep)。我重新安装了节点,它运行得很好。我使用Homebrew并安装了Node v0.8.18。