Skip to content
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

Explicitly disable CGO when building binary #104

Merged
merged 3 commits into from
Sep 21, 2023
Merged

Conversation

house-lee
Copy link
Collaborator

@house-lee house-lee commented Sep 21, 2023

What happened:
After we upgraded to go 1.21 (from go 1.16) to build the droplet-agent, the binary started to crash on some of the droplets with error message /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.32' not found`. (a report can be found here:#103)

Root cause:

  • Starting in Go 1.20, c tool chain is no longer statically linked to the go binary. Go binaries now need to manually have the C libraries properly linked.
  • Although we are not directly using CGO in this codebase, some standard libraries (net, os/user etc) that we use may have the cgo implementation chosen when building the binary, if the building environment has C tool chains available.
  • While cgo is disabled by default starting from Go 1.20, it may still be enabled if the building environment has C tool chain available, unless explicitly disabled by setting the CGO_ENABLED flag

Related Links:

Thanks @iosonogio for reporting this

@house-lee
Copy link
Collaborator Author

Fix verified. Force merging due to emergency

@house-lee house-lee merged commit a51eac7 into main Sep 21, 2023
2 checks passed
@house-lee house-lee deleted the hlee/disable-cgo branch September 21, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant