在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?提前谢谢
答案 0 :(得分:0)
bug在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'
],
}
}],
现在可以使用了