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

build(goreleaser): build with explicit CGO_ENABLED=0 #826

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Feb 15, 2023

A gotcha of using Go 1.20 is that if you build a binary on Ubuntu 22.04, it won't run on Ubuntu 20.04 (or earlier).

You'll see the following error:

/opt/hostedtoolcache/fastly/6.0.5/x64/fastly: 
    /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found 
    (required by /opt/hostedtoolcache/fastly/6.0.5/x64/fastly)

The Fastly CLI does not knowingly use any external CGO, only stdlib.

The issue is caused by changes in GLIBC, between the OS versions, and this can be solved by building it on an older version (e.g. building on Ubuntu 20.04).

Alternatively, we can set CGO_ENABLED=0 (this is the approach taken in this PR), which forces Go to use internal libraries. It's unclear if this will introduce any other issues so we may need to revert to the first approach of building with an older OS.

@Integralist Integralist added the bug Something isn't working label Feb 15, 2023
@Integralist Integralist merged commit faf9ec4 into main Feb 15, 2023
@Integralist Integralist deleted the integralist/cgo branch February 15, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant