lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
28.9k stars 1.29k forks source link

issue with libm.so.6 version #2793

Closed gifuzzz closed 3 years ago

gifuzzz commented 3 years ago

I'm using ubuntu server 20.04 on a rapsberry pi 4. I installed sharp via npm i sharp, but when i require it, it gives me this:

/home/ubuntu/node/wabot/node_modules/sharp/lib/constructor.js:32
  throw new Error(error);
  ^

Error:
Something went wrong installing the "sharp" module

/snap/core/current/lib/aarch64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/ubuntu/node/wabot/node_modules/sharp/build/Release/../../vendor/8.10.6/lib/libvips-cpp.so.42)

- Remove the "node_modules/sharp" directory then run
  "npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues

    at Object.<anonymous> (/home/ubuntu/node/wabot/node_modules/sharp/lib/constructor.js:32:9)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/home/ubuntu/node/wabot/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

This is the output of ldd --version

$ ldd --version

ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

I have a little idea: sharp checks just the directory /snap/core/current/lib/aarch64-linux-gnu/ in with the file libm.so.6 is linked to libm-2.23.so, which is an older version. In /lib/aarch64-linux-gnu/, instead, the file libm.so.6 is linked to libm-2.31.so.

lovell commented 3 years ago

Hi, you'll probably need to work out why the system runtime linker (and not sharp) is looking for shared libraries in /snap/core/current/lib/aarch64-linux-gnu/ before it looks in /lib/aarch64-linux-gnu/.

Things to consider include: Is node running via snap? Is it configured correctly? Could you have set a custom LD_LIBRARY_PATH?

There are similar reports on unrelated bug trackers and repos so this is very likely to a problem with your local setup.

https://bugs.launchpad.net/snapcraft/+bug/1889409 https://github.com/microsoft/node-pty/issues/467

gifuzzz commented 3 years ago

Is node running via snap?

Yes, it was running via snap. I removed it and installed from binary and now all works correctly!