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

fix: [build] disable cgo for binary-only deploys #846

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

lizthegrey
Copy link
Member

@lizthegrey lizthegrey commented Aug 23, 2023

Which problem is this PR solving?

  • While the Dockerfile builds with CGO_ENABLED=0, the .circleci/config.yml file left it unspecified, causing builds made for the same GOOS & GOARCH as the builder (linux/amd64 by default) to use CGO by accident since a matching C toolchain is present in the cimg/go convenience image.
root@182da09223e8:/# file /r2/refinery-linux-amd64
/r2/refinery-linux-amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=Hw78705HCrBK7Q8pUdVk/sdhqsE46-B48P0Cvx0qG/X_WRhP-ApFipSmIba6pM/l4KJK8EedZWWVdz6GgZq, with debug_info, not stripped
root@182da09223e8:/# file /r2/refinery-linux-arm64
/r2/refinery-linux-arm64: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=6i4lQA7a7nhfoijLp2bK/6a_KXrmer50H0_jir0AP/OH9eHnFudWb2KB0T2KP0/3GuMnP0C6IjvA_6jUOS9, with debug_info, not stripped
  • This results in clients using minimal/alpine or other base images with different GLIBC versions to fail to invoke only the linux/amd64 version if they copy the built binary into their environment.
/usr/local/bin/otelsamplingproxy: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/local/bin/otelsamplingproxy)
/usr/local/bin/otelsamplingproxy: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/local/bin/otelsamplingproxy)

Short description of the changes

  • Sets CGO_ENABLED=0 for go_build step on Circle.

While the Dockerfile builds with CGO_ENABLED=0, the .circleci/config.yml file left it unspecified, causing builds made for the same GOOS & GOARCH as the builder (linux/amd64 by default) to use CGO by accident since a matching C toolchain is present in the cimg/go convenience image.
@lizthegrey lizthegrey requested a review from a team as a code owner August 23, 2023 23:05
@lizthegrey lizthegrey changed the title [build] disable cgo for binary-only deploys fix: [build] disable cgo for binary-only deploys Aug 23, 2023
@kentquirk kentquirk added this to the v2.2 milestone Aug 31, 2023
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kentquirk kentquirk merged commit 514fba2 into main Aug 31, 2023
@kentquirk kentquirk deleted the lizf.fix-dynlink-artifact branch August 31, 2023 15:38
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.

2 participants