builds without setting it, so (as far as I know) cgo is disabled for cross-compilation, but enabled when building for the target architecture of the runner.
As a result, if I use an ubuntu-22.04 runner, but then install the extension on an older Ubuntu such as 20.04, I get glibc.so mismatches like this:
/home/benjamin/.local/share/gh/extensions/gh-myextension/gh-myextension: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/benjamin/.local/share/gh/extensions/gh-myextension/gh-myextension)
/home/benjamin/.local/share/gh/extensions/gh-myextension/gh-myextension: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/benjamin/.local/share/gh/extensions/gh-myextension/gh-myextension)
When running this on an Ubuntu runner, the binaries for linux-amd64 use
CGO_ENABLED=1
:https://github.com/cli/gh-extension-precompile/blob/ea409c0dc27ec3031d1b0d18d17124441d3c3b6b/build_and_release.sh#L49
builds without setting it, so (as far as I know) cgo is disabled for cross-compilation, but enabled when building for the target architecture of the runner.
As a result, if I use an
ubuntu-22.04
runner, but then install the extension on an older Ubuntu such as 20.04, I get glibc.so mismatches like this:This can be fixed by explicitly disabling cgo:
Maybe this should be the default, or at least documented in the README?