-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat: Replace CGO_ENABLED=0 with //go:build ignore #950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change anything wrt the produced binary now being dynamically vs statically linked and needing a libc in our final image?
@rbtr I had wondered the same, but my testing in KIND of the images produced was successful. I would like to see the windows images functioning, but I currently lack a handy environment to test them. |
So @rbtr, through rebuilding retina images via other means, I think we end up with a libc one way or another by virtue of the fact that we bundle |
Looks like E2Es failed on operator due to timeout. It's possible that this is an actual issue, but I'll try again to confirm it. |
We definitely have them, I'm specifically interested in whether this now means that the Go bins are dynamic and need them |
@rbtr I experimented and found that the answer is yes: we take a dependency on libc with this change. With CGO_ENABLED=1 (the paths are odd because I built it in nix):
Currently (CGO_ENABLED=0):
|
3d5ba02
to
d21c6e1
Compare
It will soon become necessary to enable CGO in builds in order to use the MS Go distribution. Disabling CGO was always somewhat of a hack since we didn't need it anyway for eBPF. Now that we do, another solution is necessary. This uses the `//go:build ignore` directive to exclude all C source files from the Go toolchain. This is necessary even within C source files even though these C source files exist within an underscore-prefixed directory. Go's behavior here is likely erroneous, and an issue has been filed for its repair: golang/go#69639
As a consequence of removing CGO_ENABLED=0, we now require glibc in the final runtime environment of both retina-agent and retina-operator. `retina-agent` had this already by consequence of the inclusion of clang and other machinery necessary to compile ebpf. `retina-operator`, however, did not. This adds the contents of /lib and /usr/lib to the final image in order to include glibc into `retina-operator`'s runtime environment.
d21c6e1
to
2a94fbb
Compare
Operator failed to start in successive runs of E2Es. Upon further investigation locally, this was a result of |
It will soon become necessary to enable CGO in builds in order to use the MS Go distribution. Disabling CGO was always somewhat of a hack since we didn't need it anyway for eBPF. Now that we do, another solution is necessary. This uses the
//go:build ignore
directive to exclude all C source files from the Go toolchain. This is necessary even within C source files even though these C source files exist within an underscore-prefixed directory. Go's behavior here is likely erroneous, and an issue has been filed for its repair:golang/go#69639