Не может найти символ "hid_open" с node-hid на Android
Поскольку я не знаком со сборкой приложений для Android и мой код JavaScript уже работает, я хочу запустить код node.js, который взаимодействует с устройством USB (колода Elgato Stream) на Android. Устройство, которое я использую - одноплатный компьютер ODROID.
Я установил node.js v8.11.3 и инструменты, необходимые для сборки C (clang, make, binutils) через среду Termux. После этого я установил пакет npm elgato-stream-deck-clean
который зависит от 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.
Как я могу это исправить?