jperkin/node-rpio

Shared files missing

Closed this issue · 2 comments

I am running an app (using node-16) in a Docker container on a Raspberry Pi that depends on rpio.
In order to control the GPIO pins, I mapped the following host directories:

  • /sys/class/gpio
  • /sys/devices/platform/soc
  • /dev/gpiomem

The container is also running with raised --privileged.

When deploying the app, I receive the following error:

Initializing HAP-NodeJS v0.9.5...
--
Error: /homekit/node_modules/rpio/build/Release/rpio.node: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1154:18)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at bindings (/homekit/node_modules/bindings/bindings.js:112:48)
at Object. (/homekit/node_modules/rpio/lib/rpio.js:17:34)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)

Upon further inspection of the container itself, I do indeed see the file /homekit/node_modules/rpio/build/Release/rpio.node. I assume that there is some sort of cross-compilation error.

Furthermore, I am able to control the GPIO pins from the deployed container directly using the following:

$ echo 21 >/sys/class/gpio/export
$ echo out >/sys/class/gpio/gpio21/direction
$ echo 1 >/sys/class/gpio/gpio21/value
$ echo 0 >/sys/class/gpio/gpio21/value

I started to look into the code and noticed that /proc/device-tree/model was not mapped from the host.

Solved this issue by running npm rebuild rpio after CI.