https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: dev-go/go-md2man-2.0.3 fails to compile. Discovered on: x86 (internal ref: tinderbox_x86) System: GCC-14-SYSTEM (https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#GCC-14) Info about the issue: https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0014
Created attachment 885018 [details] build.log build log and emerge --info
*** Bug 924630 has been marked as a duplicate of this bug. ***
*** Bug 924629 has been marked as a duplicate of this bug. ***
I can hit this with syncthing-1.27.2 with dev-lang/go-1.22.0, but downgrading Go to dev-lang/go-1.21.7, it builds fine.
(In reply to Sam James from comment #4) > I can hit this with syncthing-1.27.2 with dev-lang/go-1.22.0, but > downgrading Go to dev-lang/go-1.21.7, it builds fine. At first, this looked like https://github.com/golang/go/issues/47949, but it doesn't make sense by itself given it's a regression and that linked bug isn't.
Are you sure this is only affects x86? This comment on github suggests that it is an issue with CGO_ENABLED=0 and -buildmode=pie being incompatible and go-1.22 intentionally breaks the build in this case: github.com/golang/go/issues/64875#issuecomment-1974786520
(In reply to lukasstraub2 from comment #6) > Are you sure this is only affects x86? This comment on github suggests that > it is an issue with CGO_ENABLED=0 and -buildmode=pie being incompatible and > go-1.22 intentionally breaks the build in this case: > github.com/golang/go/issues/64875#issuecomment-1974786520 Yeah, I've seen it on amd64 too.
I hope to look at this over the weekend even though it's.. gross.
I ran into this problem on arm-musl (32bit) with dev-go/go-md2man-2.0.3 and dev-lang/go-1.22.4
Even with the latest version dev-lang/go-1.23.1 I get exactly the same error message when I compile dev-go/md2man-2.0.3. Already waiting April 2024 for the solution ;-(
(In reply to Sam James from comment #8) > I hope to look at this over the weekend even though it's.. gross. Hello Sam James, do you have any news for us in this regard? Thanks in advance.
Created attachment 906575 [details, diff] patch with CGO_ENABLED=1
Created attachment 906576 [details, diff] patch with CGO_ENABLED=1
>it is an issue with CGO_ENABLED=0 and -buildmode=pie being incompatible and go-1.22 intentionally breaks the build in this case >do you have any news for us in this regard? I suggest you to patch Makefiles with CGO_ENABLED=1 and see if it builds this way. I got go-md2man and containerd building on i686.
md2man was built, but containerd still fails with the same error. >>> Unpacking containerd-1.7.21.tar.gz to /var/tmp/portage/app-containers/containerd-1.7.21/work >>> Source unpacked in /var/tmp/portage/app-containers/containerd-1.7.21/work >>> Preparing source in /var/tmp/portage/app-containers/containerd-1.7.21/work/containerd-1.7.21 ... * ============================================================================================================================================================================================================================================= * Applying user patches from /etc/portage/patches ... * Applying go.patch ... [ ok ] * User patches applied. * ============================================================================================================================================================================================================================================= >>> Source prepared. >>> Configuring source in /var/tmp/portage/app-containers/containerd-1.7.21/work/containerd-1.7.21 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/app-containers/containerd-1.7.21/work/containerd-1.7.21 ... make -j4 'BUILDTAGS=no_cri no_devmapper seccomp' LDFLAGS= REVISION=472731909fa34bd7bc9c087e4c27943f9835f111 VERSION=v1.7.21 man -j1 + bin/gen-manpages go build -gcflags=-trimpath=/var/tmp/portage/app-containers/containerd-1.7.21/homedir/go/src -buildmode=pie -o bin/gen-manpages -ldflags '-X github.com/containerd/containerd/version.Version=v1.7.21 -X github.com/containerd/containerd/version.Revision=472731909fa34bd7bc9c087e4c27943f9835f111 -X github.com/containerd/containerd/version.Package=github.com/containerd/containerd ' -tags "no_cri no_devmapper seccomp " ./cmd/gen-manpages WORK=/var/tmp/portage/app-containers/containerd-1.7.21/temp/go-build1313120252 -buildmode=pie requires external (cgo) linking, but cgo is not enabled
The patching of containerd-1.7.22 worked for me as follows: Code: --- /Makefile 2024-10-21 06:58:29.817958556 +0200 +++ Makefile 2024-10-21 07:03:39.072092347 +0200 @@ -33,7 +33,7 @@ VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always) REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) PACKAGE=github.com/containerd/containerd -SHIM_CGO_ENABLED ?= 0 +SHIM_CGO_ENABLED ?= 1 ifneq "$(strip $(shell command -v $(GO) 2>/dev/null))" "" GOOS ?= $(shell $(GO) env GOOS)
app-containers/containerd-1.7.22 doesn't work either. I checked that the patch was applied correctly. My system is armv7. Are there any USE flags that might affect this?
I use also armv7 (odroid xu4). The patch worked for me as well. I did not have to use any special USE tags for this compilation. Used GO version: dev-lang/go-1.23.2
The error for: app-metrics/prometheus-2.43.0-r2 CHOST=armv7a-unknown-linux-gnueabihf dev-lang/go-1.22.6 profile=default/linux/arm/23.0/split-usr/armv7a_hf/hardened
(In reply to misterxx from comment #16) > The patching of containerd-1.7.22 worked for me as follows: > > Code: > --- /Makefile 2024-10-21 06:58:29.817958556 +0200 > +++ Makefile 2024-10-21 07:03:39.072092347 +0200 > @@ -33,7 +33,7 @@ > VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always) > REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff > --quiet --exit-code; then echo .m; fi) > PACKAGE=github.com/containerd/containerd > -SHIM_CGO_ENABLED ?= 0 > +SHIM_CGO_ENABLED ?= 1 > > ifneq "$(strip $(shell command -v $(GO) 2>/dev/null))" "" > GOOS ?= $(shell $(GO) env GOOS) We might want to somehow make this patch conditional just for those architectures that require CGO_ENABLED, so that we can have static binaries for other architectures that don't require CGO_ENABLED.
Created attachment 913020 [details, diff] ebuild patch conditional CGO_ENABLED=1 for x86 and arm $ARCH
Created attachment 913021 [details, diff] ebuild patch conditional CGO_ENABLED=1 for x86 and arm $ARCH
(In reply to Barnabás Virágh from comment #19) > The error for: > > app-metrics/prometheus-2.43.0-r2 > > CHOST=armv7a-unknown-linux-gnueabihf > dev-lang/go-1.22.6 > profile=default/linux/arm/23.0/split-usr/armv7a_hf/hardened I don't see any CGO-related variables in prometheus Makefile, probably because it uses npm. Can you post a full build log?
Created attachment 913101 [details] Prometheus-2.43.0-r2 build log
*** Bug 939691 has been marked as a duplicate of this bug. ***
*** Bug 941115 has been marked as a duplicate of this bug. ***
*** Bug 939190 has been marked as a duplicate of this bug. ***
Any way to fix syncthing too? I am a bit stuck on an ancient version because of this. Would very much like to upgrade but I can't find anything to patch like in the other ebuilds.
(In reply to Richard H. from comment #28) > Any way to fix syncthing too? I am a bit stuck on an ancient version because > of this. Would very much like to upgrade but I can't find anything to patch > like in the other ebuilds. grep -R CGO on /var/tmp/portage/net-p2p/syncthing-1.27.12/work/syncthing
Created attachment 918936 [details, diff] patch with CGO_ENABLED=1
> We might want to somehow make this patch conditional just for those > architectures that require CGO_ENABLED, so that we can have static binaries > for other architectures that don't require CGO_ENABLED. src_prepare() { #See bug 924632 for arch32 in x86 arm; do if [[ $ARCH = $arch32 ]]; then ewarn "Force CGO_ENABLED=1 for $ARCH, see bug #924632" sed -i 's/SHIM_CGO_ENABLED ?= 0/SHIM_CGO_ENABLED ?= 1/' \ Makefile || ewarn "Can not force CGO_ENABLED=1" fi done unset arch32 }
Patch for containerd-2.0.2: --- /Makefile 2025-02-27 09:55:29.817958556 +0200 +++ Makefile 2025-02-27 09:55:39.072092347 +0200 @@ -33,7 +33,7 @@ VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always) REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) PACKAGE=github.com/containerd/containerd/v2 -SHIM_CGO_ENABLED ?= 0 +SHIM_CGO_ENABLED ?= 1 ifneq "$(strip $(shell command -v $(GO) 2>/dev/null))" "" GOOS ?= $(shell $(GO) env GOOS)
Created attachment 920020 [details, diff] Patch for containerd-2.0.2
Tested: md2man works with patch containerd works with patch docker needs patch, but works with CGO_ENABLED=1 in /etc/portage/make.conf Thanks!
Created attachment 920700 [details, diff] Patch for go-md2man-2.0.6 to enable cgi Resolves the emerge problem when cgo need to be enabled.