Description
Building a spring cloud function native executable using
- OS: Linux
- JDK: OpenJDK 17
- Spring Boot: 3.0.0
- Graal 22.3
- native-image buildpack (standard spring boot v3 profile "native")
- Spring Cloud Function: 4.0.0-SNAPSHOT
- Using todays (SNAPSHOT) graalvm-reachability-metadata (profile "nativeRS")
- packaging a lambda zip (profile "lambda" )
Step to reproduce:
"mvn -Pnative package" my spring cloud function app on my WSLES ubuntu 22.04 shell
or
"mvn -Pnative,nativeRS,lambda package spring-boot:build-image
deploy zip file to aws lamda
execute lambda function
cloud-function-dynamodb-lambda: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./cloud-function-dynamodb-lambda)
./cloud-function-dynamodb-lambda: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./cloud-function-dynamodb-lambda)
./cloud-function-dynamodb-lambda: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./cloud-function-dynamodb-lambda)
./cloud-function-dynamodb-lambda: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./cloud-function-dynamodb-lambda)
START RequestId: 054fd135-79e2-4ec7-b080-11820822a134 Version: $LATEST
RequestId: 054fd135-79e2-4ec7-b080-11820822a134 Error: Runtime exited with error: exit status 1
Runtime.ExitError
END RequestId: 054fd135-79e2-4ec7-b080-11820822a134
REPORT RequestId: 054fd135-79e2-4ec7-b080-11820822a134 Duration: 75.74 ms Billed Duration: 76 ms Memory Size: 128 MB Max Memory Used: 4 MB
XRAY TraceId: 1-639994f6-6fc8489d57c0cd106bdbaee8 SegmentId: 11040f061038b2f9 Sampled: true
IT seems like the existing buildpack used is not providing the same? GLIBC version which is offered used by the aws lambda provided runtime.
Is there any buildback which provides a aws lambda compatible environment to build a graal native image which can be executed published as part of zipped package requesting for dynamic shared lib objects being available on aws provided runtime?
Some ideas i a, starting to investigate..
Assumption: The issue i have with GLIBC dynamic linking on aws lambda at runtime might only be there when i built with my local ubuntu 22.04 or the "tiny builder" cascade for above buidpacks?
I tried lambda runtime provided and provided.al2 (https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) which - as i thought has newer versions available - but still loading issue occurs.
I tried as well to use compiler switch on and off -H:+StaticExecutableWithDynamicLibC - same issue.
Todo:
Try to use the same image – amzn-ami-hvm-2018.03.0.20220802.0-x86_64-gp2 or similar (amazonlinux2) to build the native image on assuming it provides the same libc so linking which is needed on lambda works later
Another option is to package as container (instead of zip) where this container image (composed into a lambda layer?) brings its onw shared libs and the native executable on board - might not work together and might have start time latency downside.
- codebuild image "aws/codebuild/amazonlinux2-x86_64-standard:4.0": https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html, https://github.com/aws/aws-codebuild-docker-images/tree/master/al2/x86_64/standard/4.0
- lambda image "amazon/amzn-ami-hvm-2018.03.0.20220802.0-x86_64-gp2": https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html , https://eu-central-1.console.aws.amazon.com/ec2/v2/home?region=eu-central-1#Images:visibility=public-images;search=amzn-ami-hvm-2018.03.0.20220802.0-x86_64-gp2