Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/lib64/libc.so.6: version `GLIBC_2.32' not found

I'm building the lambda on Ubuntu with the basic example. It builds without any errors but if I upload and test it on aws in crashes with:

{
  "errorMessage": "RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b Error: Runtime exited with error: exit status 1",
  "errorType": "Runtime.ExitError"
}

The log output is:

START
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Version: $LATEST.~.jwtauthorizeraws.jwtauthorizerawsapplication: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./~.jwtauthorizerawsapplication)
END 
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
REPORT
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Duration: 56.02 ms
Billed Duration: 57 ms
Memory Size: 128 MB
Max Memory Used: 7 MB   
RequestId: 7f4d0aca-125c-4032-98dd-9ff387e5252b
Error: Runtime exited with error: exit status 1
Runtime.ExitError
like image 985
utk Avatar asked Nov 16 '25 03:11

utk


1 Answers

I recently ran into this issue.

Build your project with CGO_ENABLED=0 may be enough to fix your issue:

GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main main.go

If you are using sam, there is a --use-container flag, however this may not work for golang projects

To make sam build use a custom build command, i.e. run the go build command above, you can set the BuildMethod to makefile and create a Makefile with a target with the name build-<YourFunctionName>.

HealthCheckFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: makefile
    Properties:
      CodeUri: .
      Handler: healthcheck
      FunctionName: !Sub "healthcheck_${Env}"
      Runtime: go1.x
      Architectures:
        - x86_64
      Events:
        ...

Then the Makefile would have:

build-HealthCheckFunction:
  GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o healthcheck lambda/healthcheck/healthcheck.go
  mv healthcheck $(ARTIFACTS_DIR)

More details here on what I had to do to get this fixed in my project: https://www.gaunt.dev/blog/2022/glibc-error-with-aws-sam-and-go/

like image 199
Matt Gaunt Avatar answered Nov 18 '25 21:11

Matt Gaunt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!