make.defaults, go-env.eclass: export cgo flags, enable cgo by default

This change adds exporting CGO_* flags to go-env.eclass; the upstream pr
https://github.com/gentoo/gentoo/pull/33539 has been updated
accordingly.

Also, CGO_ENABLED=1 has been added to coreos/../make.conf to enable gco
by default. This fixes a build issue for arm64 with Docker's
device-mapper storage driver:

daemon/graphdriver/devmapper/deviceset.go:306:25: undefined: devicemapper.SetTransactionID
...
daemon/graphdriver/devmapper/deviceset.go:867:28: undefined: devicemapper.ErrEnxio
daemon/graphdriver/devmapper/deviceset.go:867:28: too many errors

gco is enabled on AMD64 by default, and cgo was always enabled in the
coreos docker ebuilds. This way we retain that setting for the Gentoo
ebuilds.
This commit is contained in:
Thilo Fromm 2023-10-27 16:50:34 +02:00
parent c522b04f2a
commit fa623fed84
2 changed files with 8 additions and 0 deletions

View File

@ -127,3 +127,6 @@ DONT_MOUNT_BOOT=1
# inside the scripts repository that poke binary packages assume that
# bzip2 is used, not zstd. Eventually we will want to move to zstd.
BINPKG_COMPRESS=bzip2
# Enable cgo by default. Required for the docker device-mapper driver to compile.
CGO_ENABLED=1

View File

@ -19,6 +19,7 @@ inherit toolchain-funcs
# @FUNCTION: go-env_set_compile_environment
# @DESCRIPTION:
# Set up basic compile environment: CC, CXX, and GOARCH.
# Also carry over CFLAGS, LDFLAGS and friends.
# Required for cross-compiling with crossdev.
# If not set, host defaults will be used and the resulting binaries are host arch.
# (e.g. "emerge-aarch64-cross-linux-gnu foo" run on x86_64 will emerge "foo" for x86_64
@ -38,6 +39,10 @@ go-env_set_compile_environment() {
tc-export CC CXX
export GOARCH
export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}"
export CGO_CXXFLAGS="${CGO_CXXFLAGS:-$CXXFLAGS}"
export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
}
fi