lovell / sharp-libvips

Packaging scripts to prebuild libvips and its dependencies - you're probably looking for https://github.com/lovell/sharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Prebuilt libvips 8.11.3 binaries are not yet available for linux-arm64v8 and `GLIBC_2.27' not found

nihalansari opened this issue · comments

Hi,

I have sharp used on an AWS sls lambda function.

Scenario 1

During the bundling step, I run the commands:

npm install

rm -rf node_modules/sharp

export SHARP_DIST_BASE_URL="https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/"

SHARP_IGNORE_GLOBAL_LIBVIPS=true npm install --arch=arm64 --platform=linux --libc=glibc sharp

The above install commands gives following build error:

npm ERR! sharp: Installation error: Prebuilt libvips 8.11.3 binaries are not yet available for linux-arm64v8

Scenario 2

If I remove the line where SHARP_DIST_BASE_URL is exported, the build process goes fine. However, when the lambda is triggered, logs show the following error:

Something went wrong installing the "sharp" module

/lib64/libm.so.6: version `GLIBC_2.27' not found (required by /var/task/node_modules/sharp/build/Release/../.././vendor/8.11.3/linux-arm64v8/lib/libvips-cpp.so.42)

Please advise.

Many Thanks,
Mo

Please upgrade to the latest version.

Thanks for the response @lovell .
I did originally use

export SHARP_DIST_BASE_URL="https://github.com/lovell/sharp-libvips/releases/download/v8.14.4/"

but it gave me the same error npm ERR! sharp: Installation error: Prebuilt libvips 8.11.3 binaries are not yet available for linux-arm64v8

Please see https://sharp.pixelplumbing.com/install#aws-lambda - you don't need SHARP_DIST_BASE_URL.

Please see https://sharp.pixelplumbing.com/install#aws-lambda - you don't need SHARP_DIST_BASE_URL.

Hi @lovell
This is the error now.

Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-arm64v8.node'
Require stack:
- /var/task/node_modules/sharp/lib/sharp.js
- /var/task/node_modules/sharp/lib/constructor.js
- /var/task/node_modules/sharp/lib/index.js
- /var/task/index.js
- /var/runtime/index.mjs

os details from lambda config is:

    "arch": "arm64",
    "platform": "linux",
    "release": "4.14.255-311-248.529.amzn2.aarch64",
    "version": "#1 SMP Wed Apr 12 19:03:21 UTC 2023"

I got this error earlier too. That's why I had --arch=arm64 while installing sharp in that command.
On the deployed lambda, this is how the directory sharp in node_modules looks like. Note that there is no file named sharp-linux-arm64v8.node, that the error message above shows:

dev-callback-request-latest/node_modules/sharp/build/
└── Release
    └── sharp-linux-x64.node

You are correct to replace --arch=x64 with --arch=arm64

@lovell Good Morning
I did the following in an attempt to fix:

  1. changed architecture of the lambda to x64
  2. installed and rebuilt both lib types for arch=x64
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm rebuild --arch=x64 --platform=linux --libc=musl sharp

Now, the code is crashing during the compression step. The error is

Error: Runtime exited with error: signal: killed

Thanks
Mo

@lovell Now we are getting it to run for images < 1MB. For bigger images its timing out(but this could be an app problem too).

Thanks.

Please see https://sharp.pixelplumbing.com/install#aws-lambda

To get the best performance select the largest memory available. A 1536 MB function provides ~12x more CPU time than a 128 MB function.

You've not provided any code samples so I've no idea what you're doing, but for running CPU-bound tasks on AWS Lambda, max out the RAM and therefore CPU. Anything else is a false economy.