-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/lib64/libc.so.6: version `GLIBC_2.32' not found when building on linux #340
Comments
yeah, I can add a note about CGO in the README. Amazon Linux 1/2 provides glibc 2.17/2.26, so I can see how this'd be a problem depending on a developer's Linux distro. |
I have witnessed this one today, seems like it is just a problem of using CGO when the C library you have under the hood is not compatible with glibc 2.32 or there is no C library but you are trying to build with CGO, therefore, it can not detect/find the correct version for .so files. It took the production down for 1 hour, just because of CGO_ENABLED=1 CGO should never be used and it should be avoided as much as possible just like the reflection |
It works. @bmoffatt Is this issue still required to be open? |
Affected by the same issue. Trying to use SQLite with go on lambda is painful. |
Just ran into this myself also trying to use go-sqlite3. @HSchmale16 did you ever find a way to get it to work? |
I ended up building and deploying from cloudshell. Had to move the GOPATH to outside of the home directory. I still haven't fully understood what lambda is doing with it. |
Gotcha - in that case the solution is probably to build the binary on some form of Amazon Linux (VM, container, etc). |
Just to follow up - confirmed at least in my case if I build the Go binary (which requires cgo, particularly using go-sqlite3) on Amazon Linux, it will execute successfully. Specifically, I used the |
@ccampo133 I've documented my fix on my blog. See link for details. https://www.henryschmale.org/2022/09/29/go-in-cloudshell.html |
I ran into this while using the SAM CLI. The fix was ultimately the suggestion to use Documented the approach for my project here: https://www.gaunt.dev/blog/2022/glibc-error-with-aws-sam-and-go/ |
@gauntface that will only work if your project does not depend on cgo. In my (and others here) case, I required cgo for |
I dont really understand this much but In my scenario i am building in an amd64 linux golang:latest docker image (
in cloudwatch logs when invoked in Lambda. Do i have to just start getting older images till i eventually get one that works with Lambda or is there any checks that i can do to see which glibc is in Lambda and then find a docker image to match? |
As a test i used an amazonlinux image as the build environment as i thought this should match the lambda env more than anything and just installed golang on it, inc all 138 dependancies which included glibc: Its now worse:
@HSchmale16 this was based of your blog post so not sure if i missed anything |
This seems super weird could something be broken with your Amazon Linux image. this is related to go being very weird about libc stuff. Can you try it on cloudshell? As that's been where I've had the most luck running this stuff.
|
@thenom I built my binary (which required CGo) using the Not sure if you use a different Amazon Linux image. |
Sorry, just to highlight and clarify my original message, the builds runs fine. The problem is when its invoked in Lambda, these are the cloudwatch logs from those invokes. @HSchmale16 this is a stock fresh amazonlinux image that i install golang on then a couple of configurations for git and junit testing, thats it. |
@ccampo133 amazonlinux:2 is better actually. The lambda invoke now only fails with 1 dependancy missing:
|
Finally got it working but my process of trial and error doesnt seem that elegant. It works with this image: Open to suggestions\advice on why this is happening or anything i can do to improve it. Thanks. |
This was absolutely terrifying to discover last minute. I recently switched all 4 of my PCs from Ubuntu to Manjaro and right as I was deploying some new code this issue popped up. I'm extremely lucky all I had to do was add I have no idea why Manjaro needs a new build flag versus Ubuntu unfortunately - that's definitely not an area of expertise for me. |
does anyone here know how i can find out what package that got included uses this? |
@smark-d here's my build command from my makefile. i build on manjaro and deploy through the serverless framework to lambda and it works fine. go is v1.20.
|
The problem is, that when building on Manjaro ( or Arch or another rolling distro) you are building your go file with a newer GLIBC (e.g. 2.32 oder higher) |
aws/aws-lambda-go#340 fixed by adding CGO e…
Hello? 3 years passed and still not resolved? |
Amazon doesn't care about open source |
It's also happening with python3.11 runtime |
And people don't appear to read the FIRST POST at the top that literally tells you how to solve it. This is a common Linux building issue. |
Build with `CGO_ENABLED=0` aws/aws-lambda-go#340
Build with `CGO_ENABLED=0` aws/aws-lambda-go#340
As an FYI since it has not been posted in this thread. Amazon Linux 2023 provides glibc 2.34, upgrade to al2023 and latest Go. |
I was running into this error when I followed the instructions in the README:
I managed to fix it via by setting
CGO_ENABLED=0
when building on linux, similar to the instructions for windows, ieShould that be included in the README, or is there a better way to fix this?
The text was updated successfully, but these errors were encountered: