mac os x 10.9.5 的节点隐藏建筑

node-hid building for mac os x 10.9.5

在 mac os x 10.9.5 上构建/使用 node-hid 时遇到问题。使用 node-gyp 构建很顺利。我只有 hidapi 警告:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/hidapi/hidapi/mac/hid.o
  ../hidapi/mac/hid.c:255:20: warning: comparison of integers of different signs:
  'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
            if (chars_copied == len)
                ~~~~~~~~~~~~ ^  ~~~
  ../hidapi/mac/hid.c:295:20: warning: comparison of integers of different signs:
  'CFIndex' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
            if (used_buf_len == len)
                ~~~~~~~~~~~~ ^  ~~~
2 warnings generated.

但测试示例给出了 dyld 错误:

sh# node src/show-devices.js
dyld: lazy symbol binding failed: Symbol not found: _IOHIDManagerCreate
  Referenced from: /Users/me/Documents/node-hid-master/build/Release/HID.node
  Expected in: dynamic lookup

为什么找不到 IOKit?提前致谢

错误在 binding.gyp 文件中

已更改

  'conditions': [
    [ 'OS=="mac"', {
      'LDFLAGS': [
        '-framework IOKit',
        '-framework CoreFoundation'
      ],
      'xcode_settings': {
        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
      }
    }],

至此

  'conditions': [
    [ 'OS=="mac"', {
      'LDFLAGS': [
        '-framework IOKit',
        '-framework CoreFoundation'
      ],
      'xcode_settings': {
        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
        'OTHER_LDFLAGS': [
          '-framework IOKit',
          '-framework CoreFoundation'
        ],    
      }
    }],

现在可以使用了