mscdex / mmmagic

An async libmagic binding for node.js for detecting content types by data inspection
MIT License
619 stars 50 forks source link

ubuntu 20.04 has GLIBC_2.28 not found error #154

Closed pyramation closed 3 years ago

pyramation commented 3 years ago

Hello, thanks for this awesome library! I've been using for a quite few years now and super happy :)

I'm running into a very similar issue to https://github.com/mscdex/mmmagic/issues/150, however, it is in regards to an older version of GLIBC (I'm running ubuntu 20.04)

Here is my GLIBC info

$ ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9) 2.31

Even though it's > 2.28, of older versions, Ubuntu 20.04 seems not to have it:

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC | grep -v XX
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.6
GLIBC_2.4
GLIBC_2.18
GLIBC_2.16
GLIBC_2.3.4
GLIBC_2.17
GLIBC_2.3.2

Here is the full error from the actual install

internal/modules/cjs/loader.js:1065
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /home/pyramation/Npm/lib/node_modules/@launchql/cli/node_modules/mmmagic/build/Release/magic.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1065:18)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/pyramation/Npm/lib/node_modules/@launchql/cli/node_modules/mmmagic/lib/index.js:1:13)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

ideas for solutions so far

I've done some digging, and found one post that suggests I should potentially attempt to re-compile mmmagic with my comp: https://superuser.com/questions/537683/how-to-fix-lib-x86-64-linux-gnu-libc-so-6-version-glibc-2-14-not-found

I suppose that could work and I could fork it, and re-publish it. However, I still wanted to run this by you and make sure it's the best option or if you had other ideas

Thanks!

pyramation commented 3 years ago

update:

I tried to just download the repo, to decouple it from the library I was using and see if I could re-build it

npm install
npm run install

and at this point, all seems to be ok... then for the test

npm run test
webql:pyramation at webql  ~/code/mmmagic on master
$ npm run test
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/3292/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> mmmagic@0.5.3 test /home/pyramation/code/mmmagic
> node test/test.js

internal/modules/cjs/loader.js:1065
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /home/pyramation/code/mmmagic/build/Release/magic.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1065:18)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/pyramation/code/mmmagic/lib/index.js:1:13)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
npm ERR! code ELIFECYCLE
mscdex commented 3 years ago

That's beyond the scope of this project, but npm seems to be cluing you into what's happening. Perhaps the snap the one node binary is being run from has a different glibc compared to the (probably your main, non-snap) environment the other node binary is running from. Try building mmmagic using the environment with the older of the two glibcs and it should then work in both places.

pyramation commented 3 years ago

thank you! That was the hint I needed. I deleted the snap node and used n to install everything and now it works! Sorry for the random issue. Cheers!