Hi,
First of all, thanks for your work on this project! I'm currently evaluating @node-3d/steam-api for an Electron game and encountered a small issue with the Linux binary.
Environment
@node-3d/steam-api: 0.4.0
- Electron: 44.0.0
- Linux x64
Problem
Loading @node-3d/steam-api from Electron fails with:
Error: /home/runner/work/steam-api/steam-api/.sdk/sdk/public/steam/lib/linux64/libsdkencryptedappticket.so: cannot open shared object file: No such file or directory
...
code: 'ERR_DLOPEN_FAILED'
I inspected the native module with:
find node_modules/@node-3d/steam-api -name '*.node' -exec \
readelf -d {} \; | grep -E 'NEEDED|RPATH|RUNPATH'
which gives:
NEEDED Shared library: [libsteam_api.so]
NEEDED Shared library: [/home/runner/work/steam-api/steam-api/.sdk/sdk/public/steam/lib/linux64/libsdkencryptedappticket.so]
NEEDED Shared library: [libstdc++.so.6]
NEEDED Shared library: [libc.so.6]
RUNPATH Library runpath: [$ORIGIN]
libsdkencryptedappticket.so itself is correctly included in the npm package:
node_modules/@node-3d/steam-api/bin-linux/libsdkencryptedappticket.so
So it looks like the absolute path from the GitHub Actions build environment is being recorded in the ELF dependency.
Workaround
I was able to make it work by replacing the absolute dependency:
patchelf \
--replace-needed \
/home/runner/work/steam-api/steam-api/.sdk/sdk/public/steam/lib/linux64/libsdkencryptedappticket.so \
libsdkencryptedappticket.so \
<native-module>.node
After that, readelf reports:
NEEDED Shared library: [libsteam_api.so]
NEEDED Shared library: [libsdkencryptedappticket.so]
RUNPATH Library runpath: [$ORIGIN]
and the package loads successfully from Electron.
Would it be possible to adjust the Linux release build so that the published native module references libsdkencryptedappticket.so rather than the absolute CI path?
Thanks again for the project and for taking a look!
Hi,
First of all, thanks for your work on this project! I'm currently evaluating
@node-3d/steam-apifor an Electron game and encountered a small issue with the Linux binary.Environment
@node-3d/steam-api: 0.4.0Problem
Loading
@node-3d/steam-apifrom Electron fails with:I inspected the native module with:
which gives:
libsdkencryptedappticket.soitself is correctly included in the npm package:So it looks like the absolute path from the GitHub Actions build environment is being recorded in the ELF dependency.
Workaround
I was able to make it work by replacing the absolute dependency:
After that,
readelfreports:and the package loads successfully from Electron.
Would it be possible to adjust the Linux release build so that the published native module references
libsdkencryptedappticket.sorather than the absolute CI path?Thanks again for the project and for taking a look!