Skip to content

Commit

Permalink
make.defaults, go-env.eclass: export cgo flags, enable cgo by default
Browse files Browse the repository at this point in the history
This change adds exporting CGO_* flags to go-env.eclass; the upstream pr
gentoo/gentoo#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.
  • Loading branch information
t-lo committed Oct 27, 2023
1 parent 8a8224d commit bd4f137
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit bd4f137

Please sign in to comment.