Issue
I've written a native library wrapper for SDL2 in C++ for NodeJS, which is in a working condition, but now I've come to a point where I've upgraded from NodeJS 10.19.0 to 15.0.1 LTS and have encountered the following error:
Error: /snap/core18/current/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /lib/x86_64-linux-gnu/libSDL2-2.0.so.0)
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1142:18)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Module.require (node:internal/modules/cjs/loader:972:19)
at require (node:internal/modules/cjs/helpers:88:18)
at Object.<anonymous> (/usr/lib/lotus/native/sdl2/index.js:1:13)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14) {
code: 'ERR_DLOPEN_FAILED'
}
I've tried following a few online guides such as this among others, to no avail. I suspect it isn't a dependency issue as the exact same program runs under 10.19.0. Although that version was installed through apt
and 15.0.1 with snap
. I'm not entirely convinced this is the cause of the issue though, as 15.0.1 works with other native libraries such as NodeGUI which relies on Qt and Electron.
I'm not familiar enough with Linux to debug this myself, so if there's any suggestion towards potentially resolving this, that would be greatly appreciated.
Edit: I've managed to work out that the same program works under 15.0.1 if NodeJS is installed through APT. Either way, this is frustrating and I'd greatly appreciate some help in using the snap version.
Edit 2: Reinstalling my entire system did nothing.
Solution
Bit late to my own show, but I've since worked out the issue: On my system, snap packages cause issues with LibCs, especially for NodeJS installations. Since I'm working with lower-level system resources, Snap pushes obstacles in the way.
The solution was to use a straight nodejs install from APT.
Answered By - J-Cake Answer Checked By - David Marino (WPSolving Volunteer)