Error: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so)

huangapple go评论72阅读模式
英文:

Error: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so)

问题

我需要一个关于这个问题的“白痴”级别的答案,我知道这个问题以前被问过。

我们正在使用Serverless框架来托管在AWS上的应用程序。 Runtime=python3.8 我们有一个包含16个函数的大型yml文件,其中有2个函数包括用于加密和PyNaCl的层,我们从这里获取 - https://github.com/keithrozario/Klayers,并且已经成功使用了相当长时间。

上周,我需要更新一个不同的函数,这意味着重新测试,这意味着找到了Cryptography层的更新版本,所以我将其更新为Cryptography v.39。现在我有一个出现错误的函数,错误消息为:/lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so) 这个函数自07/2022以来就没有被使用过,当时它还很正常。显然,从Serverless重新部署以来已经有这么长时间了。

尝试解决问题:

这个问题 https://stackoverflow.com/questions/69475140/lambda-function-failing-with-lib64-libc-so-6-version-glibc-2-18-not-found 包括建议从Cryptography v.39 回退到v.3.4.7(从03/2021),这似乎是不好的建议。毫无疑问,这两个版本之间的14次更新包括一些重要的更改。

我感到非常困惑。我感觉自己一直在打转,与此同时无法在我尝试更新的实际函数上取得进展,因为这是一个巨大的障碍。

英文:

I need a 'for dummies' answer to this question that I know has been asked before.

We're using the Serverless framework for an AWS-hosted application. Runtime=python3.8 Got a nice big yml file that includes 16 functions, 2 of which include layers for Cryptography and for PyNaCl, which we bring in from here - https://github.com/keithrozario/Klayers and have used successfully for quite a while.

Last week, I needed to update a different function, which meant re-testing, which meant finding there's a newer version of the cryptography layer, so I updated it to have Cyptography v.39. Now I have a function that fails with the error, /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /var/task/cryptography/hazmat/bindings/_rust.abi3.so) This function hasn't been used since 07/2022, at which time it was just fine. Apparently it's also been that long since we redeployed from Serverless.

Attempts to fix:

This question https://stackoverflow.com/questions/69475140/lambda-function-failing-with-lib64-libc-so-6-version-glibc-2-18-not-found includes the advice to move from Cryptography v.39 all the way back to v.3.4.7 (from 03/2021), which seems like bad advice. Surely the 14 updates between those 2 versions include some important changes.

I'm at a loss. I feel like I'm just running in circles, and meanwhile can't make progress on the actual function I'm trying to update because this is such a block.

答案1

得分: 5

我正在使用Serverless和https://www.npmjs.com/package/serverless-python-requirements来打包一个Python 3.9函数,遇到了相同的错误。我向serverless插件添加了一些pip参数,以指定目标系统,这让我成功解决了这个问题:
pipCmdExtraArgs: ['--platform manylinux2014_x86_64', '--only-binary=:all:']

这是我在插件中使用的完整配置(来自我的serverless.ts文件):

pythonRequirements: {
      dockerizePip: false,
      usePoetry: false,
      layer: true,
      useDownloadCache: false,
      useStaticCache: false,
      pipCmdExtraArgs: ['--platform manylinux2014_x86_64', '--only-binary=:all:'],
      slim: true
    }

这会生成类似这样的pip安装命令(以防你在流水线中手动调用pip安装):
python3.9 -m pip install --platform manylinux2014_x86_64 --only-binary=:all: -t /someOutputFolder -r requirements.txt

更新:我发现另一个选项是在Lambda容器中使用Docker容器,并在Dockerfile中安装Python依赖项,可以参考这些文档:https://docs.aws.amazon.com/lambda/latest/dg/images-create.html
Serverless使部署容器映像变得非常简单:https://www.serverless.com/blog/container-support-for-lambda

英文:

I'm using Serverless and https://www.npmjs.com/package/serverless-python-requirements to bundle a Python 3.9 function, and was hitting the same error. I added a couple of pip args to the serverless plugin to specify the target system, which got me past the issue:
pipCmdExtraArgs: ['--platform manylinux2014_x86_64', '--only-binary=:all:']
Here is the full config I'm using for the plugin (from my serverless.ts):

pythonRequirements: {
      dockerizePip: false,
      usePoetry: false,
      layer: true,
      useDownloadCache: false,
      useStaticCache: false,
      pipCmdExtraArgs: ['--platform manylinux2014_x86_64', '--only-binary=:all:'],
      slim: true
    }

which results in a pip install command that looks like this (just in case you are calling pip install manually in your pipeline):
python3.9 -m pip install --platform manylinux2014_x86_64 --only-binary=:all: -t /someOutputFolder -r requirements.txt

Update: Another option I've found is to use a docker container as the lambda container, and install the python dependencies in the dockerfile, as shown in these docs: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html
Serverless makes it really easy to deploy the container image: https://www.serverless.com/blog/container-support-for-lambda

huangapple
  • 本文由 发表于 2023年2月9日 01:38:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75389710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定