mmomtchev / node-gdal-async

Node.js bindings for GDAL (Geospatial Data Abstraction Library) with full async support
https://mmomtchev.github.io/node-gdal-async/
Apache License 2.0
129 stars 26 forks source link

Upgrading to Lambda Node v18 Error: /lib64/libc.so.6: version `GLIBC_2.28' not found #99

Closed alexcroox closed 1 year ago

alexcroox commented 1 year ago

Previously I was using node v16 and gdal-async was in an AWS lambda layer.

I've since started using node v18 and updated my dependencies.

I'm running on a Mac M1 so I run:

npm install gdal-async --no-save --build-from-source --shared_gdal && npm explore gdal-async -- npm run prune

Then I download the latest node-v108-linux-x64 from your releases page and add that to my layer:

nodejs/node_modules/gdal-async/lib/binding/node-v108-linux-x64/

However Lambda is now erroring on launch with:

Error: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /opt/nodejs/node_modules/gdal-async/lib/binding/node-v108-linux-x64/gdal.node)

What am I missing in these steps.

Thanks!

alexcroox commented 1 year ago

I'm getting this after downgrading to Lambda node v16 so I think something else is going on

mmomtchev commented 1 year ago

Normally Node.js 18 requires glibc 2.28 which Amazon does not propose on Amazon Linux. There is Amazon Linux 2022 and now 2023 which have it.

I don't know where is your Node.js coming from - but it is definitely not an official build from Nodesource. I guess that somebody at Amazon has hacked it to build without glibc 2.28.

Normally, in this case, this build should get assigned a new unique ABI version number. The Node.js team is the one that should provide it and the Amazon team is the one that is supposed to ask for it. This will prevent npm from installing pre-built binaries that are not compatible.

However whatever they decide to do, your only option is to build gdal-async yourself - as there won't be any prebuilt binaries for this custom version.

Or, you should upgrade to Amazon Linux 2022/2023 and use an official Node.js 18 build from Nodesource.

mmomtchev commented 1 year ago

Using gdal-async@3.6.2 should also be possible