在Android上无法通过节点隐藏找到符号“ hid_open”

时间:2018-07-21 11:39:03

标签: android node.js hidapi termux

由于我不熟悉构建Android应用程序,并且我的JavaScript代码已经可以运行,因此我想运行node.js代码,该代码与Android上的USB设备(Elgato Stream Deck)进行交互。我使用的设备是ODROID单板计算机。

我安装了node.js v8.11.3和通过Termux环境构建C所需的工具(clang,make,binutils)。之后,我安装了依赖于elgato-stream-deck-clean的npm软件包node-hid。安装和编译似乎成功。

# npm install elgato-stream-deck-clean

> node-hid@0.6.0 install /data/data/com.termux/files/home/streamdeck/node_modules/node-hid
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=8.11.3 runtime=node arch=arm platform=android)
make: Entering directory '/data/data/com.termux/files/home/streamdeck/node_modules/node-hid/build'
  AR(target) Release/obj.target/hidapi.a
  COPY Release/hidapi.a
  CXX(target) Release/obj.target/HID/src/HID.o
clang-6.0: warning: argument unused during compilation: '-e xceptions' [-Wunused-command-line-argument]
clang-6.0: warning: argument unused during compilation: '-e xceptions' [-Wunused-command-line-argument]
../src/HID.cc:207:45: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
    Local<Object> buf = nodeBufConstructor->NewInstance(1, nodeBufferArgs);
                                            ^
/data/data/com.termux/files/home/.node-gyp/8.11.3/include/node/v8.h:3846:3: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/data/data/com.termux/files/home/.node-gyp/8.11.3/include/node/v8config.h:321:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/HID.cc:231:20: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  iocb->_callback->Call(2, argv);
                   ^
../../nan/nan.h:1617:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings generated.
  SOLINK_MODULE(target) Release/obj.target/HID.node
clang-6.0: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
  COPY Release/HID.node
make: Leaving directory '/data/data/com.termux/files/home/streamdeck/node_modules/node-hid/build'
npm WARN saveError ENOENT: no such file or directory, open '/data/data/com.termux/files/home/streamdeck/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/data/data/com.termux/files/home/streamdeck/package.json'
npm WARN streamdeck No description
npm WARN streamdeck No repository field.
npm WARN streamdeck No README data
npm WARN streamdeck No license field.

+ elgato-stream-deck-clean@1.0.0
added 65 packages in 23.526s

但是当我想运行我的代码时,似乎在搜索路径中找不到该库。

#node index.js
WARNING: linker: /data/data/com.termux/files/home/streamdeck/node_modules/node-hid/build/Release/HID.node has text relocations. This is wasting memory and prevents security hardening. Please fix.
/data/data/com.termux/files/home/streamdeck/node_modules/bindings/bindings.js:88
        throw e
        ^

Error: dlopen failed: cannot locate symbol "hid_open" referenced by "/data/data/com.termux/files/home/streamdeck/node_modules/node-hid/build/Release/HID.node"...
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at bindings (/data/data/com.termux/files/home/streamdeck/node_modules/bindings/bindings.js:81:44)
    at loadBinding (/data/data/com.termux/files/home/streamdeck/node_modules/node-hid/nodehid.js:9:38)
    at Object.showdevices [as devices] (/data/data/com.termux/files/home/streamdeck/node_modules/node-hid/nodehid.js:110:5)
    at new StreamDeck (/data/data/com.termux/files/home/streamdeck/node_modules/elgato-stream-deck-clean/index.js:96:24)

我的搜索路径是

# echo $LD_LIBRARY_PATH
/system/lib:/data/data/com.termux/files/usr/lib


# find /system/lib/ /data/data/com.termux/files/usr/lib -name *hid*
/system/lib/libhidcommand_jni.so

对我来说似乎没有生成.so文件,但是我不确定node.js是否需要此文件。

我该如何解决?

0 个答案:

没有答案