Wrapping an electron application in a snap, using node child-process to launch mongodb, and include gcc libraries

I can launch mongod (once included in the snap deployment/unpackaging) using const { spawn } = require(‘child_process’); like “spawn(mongodPath, [‘–port’, ‘27080’, ‘–dbpath’, dbFolder, ‘–logpath’, logFile]);”

I get this error when launching my snap, when it is in the electron application, using nodejs child-process “spawn”: “/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38’ not found (required by mongod)”

SO MY QUESTION IS how do I include the correct files in a ?lib folder so they are located successfully. I have it working for imagemagick, now trying to get mongodb to work…

Do you have your snapcraft.yaml available you could show to us ?

Else, how do you get mongodb into your snap in the first place, this looks like you are using a pre-built binary that is incompatible with the base: you are using in your snap …

(note that libc comes from the base and you can not simply mix different libc library versions, you need to make sure that all apps you ship inside your snap use the same glibc version)

1 Like

Now I understand the base a bit better. Thanks! My next course of action is to to compile mongodb static, as a single file with all dependencies included. Maybe that will work… “bazel build install-dist-test --linkstatic” but it needs GLIBC 2.38, so setting up Ubuntu 23.10 “Mantic Minotaur” (GLIBC 2.38), and going to do it again. Thanks for your input, much appreciated. I will update in a day or two once I get through that and see if that is a solution…

base: core22

Does one of the base values have GLIBC 2.38 associated with it? Not sure if it works that way…

does it not build with 2.39 (which is shipped in the core24 base)?

23.10 is long EOL so you will not easily be able to use its glibc …

Thank you! I switched to base: core24 and it works great.

1 Like