简体   繁体   English

/lib64/libc.so.6:找不到版本“GLIBC_2.32”

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

I'm building the lambda on Ubuntu with the basic example.我正在使用基本示例在 Ubuntu 上构建 lambda。 It builds without any errors but if I upload and test it on aws in crashes with:它构建时没有任何错误,但如果我在 aws 上上传并测试它,它会崩溃:

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

The log output is:日志output是:

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

It probably means that the glibc version used to build the executable is different than the docker environment is using.这可能意味着用于构建可执行文件的glibc版本与 docker 环境使用的不同。

So, check the build environment ldd --version will reveal the glibc version.因此,检查构建环境ldd --version将显示 glibc 版本。

Now, in your docker container ( docker run -ti --entrypoint=/bin/bash dockerimage:tag ) type the same ldd command.现在,在您的 docker 容器 ( docker run -ti --entrypoint=/bin/bash dockerimage:tag ) 中键入相同的ldd命令。 You'll probably see that the versions are different.您可能会看到版本不同。 So, update either the build environment to use the same version as the docker environment or vice-versa.因此,更新构建环境以使用与 docker 环境相同的版本,反之亦然。

The best way to avoid this is to use the runtime environment to build your native executable: this way the glibc version will always match.避免这种情况的最佳方法是使用运行时环境来构建您的本机可执行文件:这样glibc版本将始终匹配。

FWIW, in Quarkus, we have a feature called in-container build, which allows to create your native image inside a container that is compatible with the runtime images we use. FWIW,在 Quarkus 中,我们有一个称为容器内构建的功能,它允许在与我们使用的运行时图像兼容的容器内创建您的原生图像。

Using -Dquarkus.native.container-build=true makes it happen.使用-Dquarkus.native.container-build=true可以实现。

Not saying you should migrate to Quarkus but if you want to build native images, you really need to build them in an environment compatible with your runtime environment so you will end up having to build in a container.并不是说你应该迁移到 Quarkus,但如果你想构建原生图像,你真的需要在与你的运行时环境兼容的环境中构建它们,所以你最终将不得不在容器中构建。

I recently ran into this issue.我最近遇到了这个问题。

Build your project with CGO_ENABLED=0 may be enough to fix your issue :使用CGO_ENABLED=0构建项目可能足以解决您的问题

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如果您使用的是sam ,则有一个--use-container标志,但这可能不适用于 golang 项目

To make sam build use a custom build command, ie 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> .要使sam build使用自定义构建命令,即运行上面的go build命令,您可以将BuildMethod设置为makefile并创建一个Makefile ,其目标名称为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:那么Makefile将具有:

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/有关我必须做些什么才能在我的项目中修复此问题的更多详细信息: https://www.gaunt.dev/blog/2022/glibc-error-with-aws-sam-and-go/

the environment you are executing the seems doesn't provide a Glibc version in version 2.32.您正在执行的环境似乎没有在 2.32 版中提供 Glibc 版本。

This can have several problems: the version of your the Lambda env is older, or it doesn't provide an GlibC at all (which can be the case).这可能有几个问题:您的 Lambda env 的版本较旧,或者它根本不提供 GlibC(可能是这种情况)。

if you application would be pure java (without creating an native app via graal) it would run since the java app itself doesn't depend a version of GLibC, the requirment comes from the native app.如果您的应用程序是纯 java(不通过 graal 创建本机应用程序),它将运行,因为 java 应用程序本身不依赖于 GLibC 版本,该要求来自本机应用程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 [AWS Lambda]:如何修复“/lib64/libm.so.6:未找到‘GLIBC_2.29’版本” - [AWS Lambda]: How to fix "/lib64/libm.so.6: version `GLIBC_2.29' not found" [AWS Lambda]:如何修复“未找到 GLIBC 2.27 版本” - [AWS Lambda]: How to fix "version GLIBC 2.27 Not found" 从 lambda function 中找不到名为“pyarrow.lib”的模块 - No module named 'pyarrow.lib' found from lambda function Python / R ctypes库错误:“ OSError:lib / libRrefblas.so:未定义符号:xerbla_” - Python/R ctypes library error: “OSError: lib/libRrefblas.so: undefined symbol: xerbla_” 带有pyodbc的AWS Lambda Python-无法导入模块&#39;lambda_function&#39;:/var/task/lib/libodbc.so.2:文件太短 - AWS Lambda Python with pyodbc - Unable to import module 'lambda_function': /var/task/lib/libodbc.so.2: file too short 为什么 AWS SAM CLI 1.33.0 会因 _regex.cpython-38-darwin.so 在 Apple M1 芯片上找不到合适的图像而崩溃? - Why does AWS SAM CLI 1.33.0 crash with _regex.cpython-38-darwin.so no suitable image found on Apple M1 chips? “无法加载本机模块‘Crypto.Cipher._raw_ecb’:在 python 3.8 上运行 Lambda 时尝试‘_raw_ecb.cpython-38-x86_64-linux-gnu.so’ - "Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cpython-38-x86_64-linux-gnu.so' when running Lambda on python 3.8 为AWS-Lambda编译pdftohtml二进制文件:GLIBC问题 - Compiling pdftohtml binary for AWS-Lambda: GLIBC issues 在 AWS codebuild 的命令行上构建 lambda zip 文件失败,并显示“找不到所需的库 libhostfxr.so” - Building an lambda zip file on the commandline in AWS codebuild fails with "the required library libhostfxr.so could not be found" Lambda 的 AWS SDK V2 Maven 库是什么? - What's the AWS SDK V2 Maven lib for Lambda?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM