Gentoo emerge GO lang failed – atomic_amd64x.go: too many errors

Author:

Upgrading GO lang under Gentoo maybe a little bit tricky. The upgrading go lang from 1.13.7 to 1.15.5 failed with strange error:

# runtime/internal/atomic
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:18:6: Load redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:16:24
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:24:6: Loadp redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:22:32
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:30:6: Load64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:28:26
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:36:6: LoadAcq redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:34:27
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:41:6: Xadd redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:39:37
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:44:6: Xadd64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:42:39
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:47:6: Xadduintptr redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:45:47
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:50:6: Xchg redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:48:36
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:53:6: Xchg64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:51:38
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:56:6: Xchguintptr redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:54:45
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:56:6: too many errors

Googling a little bit and it appeared there might be a conflict with the old version in the same directory. Deleting the temporary build directory didn’t help…

Removing the GO lang package by unmerge command and then emerging the newest GO lang package is successful.

So the solution is to unmerge it and then immediately emerge the newest version with:

emerge -vC dev-lang/go
emerge -v dev-lang/go

The whole Gentoo output of the failed emerge command

root@srv ~ # emerge -v go

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] dev-lang/go-1.15.5:0/1.15.5::gentoo [1.13.7:0/1.13.7::gentoo] 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) dev-lang/go-1.15.5::gentoo
 * go1.15.5.src.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                    [ ok ]
>>> Unpacking source...
>>> Unpacking go1.15.5.src.tar.gz to /var/tmp/portage/dev-lang/go-1.15.5/work
>>> Source unpacked in /var/tmp/portage/dev-lang/go-1.15.5/work
>>> Preparing source in /var/tmp/portage/dev-lang/go-1.15.5/work/go ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/go-1.15.5/work/go ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-lang/go-1.15.5/work/go ...
+ set -e
+ export GOENV=off
+ GOENV=off
+ unset GOBIN
+ unset GOFLAGS
+ unset GO111MODULE
+ '[' '!' -f run.bash ']'
+ '[' '' '!=' '' ']'
+ case "$(uname)" in
++ uname
+ ld --version
+ grep 'gold.* 2\.20'
+ for se_mount in /selinux /sys/fs/selinux
+ '[' -d /selinux -a -f /selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
+ for se_mount in /selinux /sys/fs/selinux
+ '[' -d /sys/fs/selinux -a -f /sys/fs/selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
+ /usr/sbin/selinuxenabled
+ cat /sys/fs/selinux/booleans/allow_execstack
+ grep -c '^1 1$'
++ uname -s
+ '[' Linux = GNU/kFreeBSD ']'
+ '[' -f /etc/alpine-release ']'
+ rm -f ./runtime/runtime_defs.go
+ verbose=false
+ vflag=
+ '[' '' = -v ']'
+ export GOROOT_BOOTSTRAP=/usr/lib/go
+ GOROOT_BOOTSTRAP=/usr/lib/go
++ cd ..
++ pwd
+ export GOROOT=/var/tmp/portage/dev-lang/go-1.15.5/work/go
+ GOROOT=/var/tmp/portage/dev-lang/go-1.15.5/work/go
+ IFS='
'
++ type -ap go
+ for go_exe in $(type -ap go)
+ '[' '!' -x /usr/lib/go/bin/go ']'
+ unset IFS
++ /usr/lib/go/bin/go version
++ sed 's/go version //'
+ GOROOT_BOOTSTRAP_VERSION='go1.14.4 linux/amd64'
+ echo 'Building Go cmd/dist using /usr/lib/go. (go1.14.4 linux/amd64)'
Building Go cmd/dist using /usr/lib/go. (go1.14.4 linux/amd64)
+ false
+ '[' '!' -x /usr/lib/go/bin/go ']'
+ '[' /usr/lib/go = /var/tmp/portage/dev-lang/go-1.15.5/work/go ']'
+ rm -f cmd/dist/dist
+ GOROOT=/usr/lib/go
+ GOOS=
+ GOARCH=
+ GO111MODULE=off
+ /usr/lib/go/bin/go build -o cmd/dist/dist ./cmd/dist
# runtime/internal/atomic
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:18:6: Load redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:16:24
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:24:6: Loadp redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:22:32
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:30:6: Load64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:28:26
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:36:6: LoadAcq redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:34:27
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:41:6: Xadd redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:39:37
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:44:6: Xadd64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:42:39
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:47:6: Xadduintptr redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:45:47
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:50:6: Xchg redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:48:36
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:53:6: Xchg64 redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:51:38
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:56:6: Xchguintptr redeclared in this block
        previous declaration at /usr/lib/go/src/runtime/internal/atomic/atomic_amd64.go:54:45
/usr/lib/go/src/runtime/internal/atomic/atomic_amd64x.go:56:6: too many errors
 * ERROR: dev-lang/go-1.15.5::gentoo failed (compile phase):
 *   build failed
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called src_compile
 *   environment, line 1239:  Called die
 * The specific snippet of code:
 *       bash -x ./make.bash || die "build failed"
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/go-1.15.5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/go-1.15.5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/go-1.15.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/go-1.15.5/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/go-1.15.5/work/go/src'
 * S: '/var/tmp/portage/dev-lang/go-1.15.5/work/go'

>>> Failed to emerge dev-lang/go-1.15.5, Log file:

>>>  '/var/tmp/portage/dev-lang/go-1.15.5/temp/build.log'

 * Messages for package dev-lang/go-1.15.5:

 * ERROR: dev-lang/go-1.15.5::gentoo failed (compile phase):
 *   build failed
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called src_compile
 *   environment, line 1239:  Called die
 * The specific snippet of code:
 *       bash -x ./make.bash || die "build failed"
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/go-1.15.5::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/go-1.15.5::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/go-1.15.5/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/go-1.15.5/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/go-1.15.5/work/go/src'
 * S: '/var/tmp/portage/dev-lang/go-1.15.5/work/go'

Leave a Reply

Your email address will not be published. Required fields are marked *