Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[AWS Lambda]: How to fix "version GLIBC 2.27 Not found"

I would like to deploy and test my Lambda function, but, every time I try to do that I am getting following error message:

2019-11-11 13:25:33 Mounting /tmp/tmphebm3s_4 as /var/task:ro,delegated inside runtime container
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_dnn.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_video.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_objdetect.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_features2d.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_imgproc.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libopencv_core.so.4.1)
/var/task/bin/inference: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /opt/lib/libinference_engine.so)
/var/task/bin/inference: /lib64/libdbus-1.so.3: no version information available (required by /opt/lib/libatk-bridge-2.0.so.0)
^C/var/task/bin/inference: /lib64/libdbus-1.so.3: no version information available (required by /opt/lib/libatspi.so.0)
Makefile:85: recipe for target 'run-inference' failed

Note that inference is name of my Lambda functions binary.

I found about this link: https://aws.amazon.com/premiumsupport/knowledge-center/lambda-linux-binary-package/ that lets me use Amazon Linux box in order to create deployment package adequate for Lambda function execution environment.

My plan was to copy code to EC2 instance and build it with GLIBC version installed on it. I think that this would fix issue mentioned above.

Problem is that, once I SSH to EC2 instance, how do I copy my code to it and then build it? I am not an expert in linux so this is kinda confusing to me.

Thanks in advance!

like image 210
Stefan Radonjic Avatar asked Nov 11 '19 12:11

Stefan Radonjic


People also ask

How do I troubleshoot failures in an AWS Lambda function?

To troubleshoot Lambda code errors You can use CloudWatch to view all logs generated by your function's code and identify potential issues. For more information, see Accessing Amazon CloudWatch Logs for AWS Lambda.

Which TCP port traffic is blocked in AWS Lambda?

TCP port 25 traffic is also blocked as an anti-spam measure. Q: How do I create an AWS Lambda function using the Lambda console? If you are using Node.

What is publish new version in AWS Lambda?

The new version is a copy of the unpublished version of the function. Lambda doesn't create a new version if the code in the unpublished version is the same as the previous published version. You need to deploy code changes in $LATEST before you can create a new version.


1 Answers

I have just answered a similar question that addresses that issue you had, in which was the same issue I had earlier today. Please look at:

How can I use environmental variables on AWS Lambda?

In addition to looking there, please note that you will have to pack a layer into your AWS Lambda Function in which will need to have the correct LIB files -- "libm.so.6" is one for example -- in the lib folder of your layer. After that, you will need to set up the environmental variable, as explained in the link above, so that the correct lib file of your layer is used at runtime and thus your code runs successfully.

In order to get the correct LIB file, I would suggest googling more, and also trying to run your code in conda. My project was developed in a conda environment, and when I translated into a virtualenv so that I could package into a Layer and then upload to AWS Lambda, I noticed that I was getting that error too. I then grabbed the correct lib file from either (don't remember now) the lib folder of my conda environment, or the lib folder of the conda installation directory, and I placed in the lib folder of my layer package. After that, I stll had to set the environment variable so that those specific lib files would load and be linked to the python runtime.

like image 168
Raphael Setin Avatar answered Sep 24 '22 07:09

Raphael Setin