lambgeo / docker-lambda

AWS Lambda friendly GDAL Docker images and AWS Lambda layer
MIT License
121 stars 17 forks source link

Run patchelf on libgdal #74

Closed jasongi closed 5 months ago

jasongi commented 6 months ago

Fixes #71

I'm a bit out of my depth on this issue, but this seems to work. Unsure if we should also do this for other libs - I don't seem to have a problem with other libs though.

I've pushed the image at ghcr.io/jasongi/lambda-gdal:3.8-python3.11 if you want to try it.

vincentsarago commented 6 months ago

I don't seem to have a problem with other libs though.

Well it seems that it's happening for other libs 😬

bash-4.2# ldd libproj.so | grep "sql"
        libsqlite3.so.0 => /lib64/libsqlite3.so.0 (0x00000040023b2000)

When checking your image I'm not 💯 sure this is correct 👀

docker run --platform=linux/amd64 --entrypoint bash --rm ghcr.io/jasongi/lambda-gdal:3.8-python3.11 ldd /opt/lib/libgdal.so | grep "sql"
Status: Downloaded newer image for ghcr.io/jasongi/lambda-gdal:3.8-python3.11
        libsqlite3.so.0 => /var/lang/lib/libsqlite3.so.0 (0x0000004006e28000)
jasongi commented 6 months ago

@vincentsarago my bad, gave the wrong image link

it should be ghcr.io/jasongi/lambda-gdal:3.8

the python version is hardcoded to ghcr.io/lambgeo/lambda-gdal so doesn't have my fix. But I just changed that on my fork so the images will build - should be pushed in a little bit.

docker-lambda % docker run --platform=linux/amd64 --entrypoint bash --rm ghcr.io/jasongi/lambda-gdal:3.8 ldd /opt/lib/libgdal.so | grep "sql"
    libsqlite3.so.0 => /opt/lib/libsqlite3.so.0 (0x00007f124f63c000)

RE PROJ: we could probably do the same thing there. But for say, django, it's GDAL that gets loaded first not PROJ so I think there is still value in just doing this?

edit: Raised a PR for running patchelf on all .so files in /opt/lib - https://github.com/lambgeo/docker-lambda/pull/75 - the docker image at ghcr.io/jasongi/lambda-gdal:3.8 now is built on that code instead.