yay 10.1.0 does not compile: invalid flag in go:cgo_ldflag

Created on 13 Nov 2020  路  13Comments  路  Source: Jguer/yay

Affected Version

yay 10.1.0

Describe the bug
Cannot build

To Reproduce
In an up-to-date arch install:

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Expected behavior
The build finishes and install correctly.

Output

$ makepkg -si
==> Making package: yay 10.1.0-1 (Fri 13 Nov 2020 10:15:56 PM CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading yay-10.1.0.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   118  100   118    0     0   1123      0 --:--:-- --:--:-- --:--:--  1113
100  339k  100  339k    0     0   980k      0 --:--:-- --:--:-- --:--:--  980k
==> Validating source files with sha256sums...
    yay-10.1.0.tar.gz ... Passed
==> Extracting sources...
  -> Extracting yay-10.1.0.tar.gz with bsdtar
==> Starting build()...
go build -v -trimpath -mod=readonly -modcacherw -ldflags '-s -w -extldflags "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" -X "main.yayVersion=10.1.0" -X "main.localePath=/usr/share/locale/"' -buildmode=pie -o yay
go: downloading golang.org/x/crypto v0.0.0-20200930160638-afb6bcd081ae
go: downloading github.com/mikkeloscar/aur v0.0.0-20200113170522-1cb4e2949656
go: downloading github.com/leonelquinteros/gotext v1.4.0
go: downloading github.com/Morganamilo/go-srcinfo v1.0.0
go: downloading github.com/Jguer/go-alpm/v2 v2.0.1
go: downloading github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
go: downloading golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/stretchr/testify v1.6.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
runtime/cgo
go build runtime/cgo: invalid flag in go:cgo_ldflag: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
make: *** [Makefile:127: yay] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
Triage Bug

Most helpful comment

go 2:1.15.5-2 fixes this, now available at https://www.archlinux.org/packages/community/x86_64/go/

Fix for reference: https://github.com/archlinux/svntogit-community/commit/76b8e8d8f7de84d66f4fab2cf206a2bdf4f325eb#diff-790c8e824f8982e51c3d5f47359ce082e7c8febebb302460c51a9784340e3058

All 13 comments

I am experiencing the same issue on a fresh ArchARM install on a RaspberryPi3.

I am experiencing this in an install script I am building on x86_64 standard hardware.

I had the same problem here, as a workaround I cloned this repo and built from source.

git clone https://github.com/Jguer/yay/
cd yay
make
chmod +x yay
mv yay ~/.local/bin

Same issue here, I'm installing a new machine, were I have the installation method through git, I'm wondering if isn't best to download the pacman packages from the releases, however seems are missing the pacman metadata file eg; yay_10.1.0_x86_64.tar.gz.xz

Same issue here, have tried on three arch install. Two of which was fresh ones

I managed to find a work around on the issue, It uses an old package of go but it works.

sudo pacman -R go
sudo pacman -U https://archive.archlinux.org/repos/2020/10/31/community/os/x86_64/go-2%3A1.15.3-1-x86_64.pkg.tar.zst

then try again

go verison: 2:1.15.3-1

I managed to find a work around on the issue, It uses an old package of go but it works.

sudo pacman -R go
sudo pacman -U https://archive.archlinux.org/repos/2020/10/31/community/os/x86_64/go-2%3A1.15.3-1-x86_64.pkg.tar.zst

then try again

go verison: 2:1.15.3-1

One version back is enough:
https://archive.archlinux.org/packages/g/go/go-2%3A1.15.4-1-x86_64.pkg.tar.zst

Just to clarify.
It's not so much a yay issue.
It's a change in go 1.15.5 which is incompetable with default arch config or go package guidline.

One of these two is probably the source of the breaking change:

go 2:1.15.5-2 fixes this, now available at https://www.archlinux.org/packages/community/x86_64/go/

Fix for reference: https://github.com/archlinux/svntogit-community/commit/76b8e8d8f7de84d66f4fab2cf206a2bdf4f325eb#diff-790c8e824f8982e51c3d5f47359ce082e7c8febebb302460c51a9784340e3058

Confirming the new go package does fix this, closing, thanks!

I don't know so much about this. But I got same issue here. My system is updated. I can build other package. But when build yay, this issue happen.

@faea726 Can you confirm that when you run pacman -Q go you have indeed the version 2:1.15.5-2? (Or higher if a new version should be released between now and when you're reading this.)

@grandchild I've just checked. The version is 2:1.15.5-1, and arch data's version is 2:1.15.5-2. I'm trying to update it.
Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GhostKraft picture GhostKraft  路  4Comments

ricochet1k picture ricochet1k  路  4Comments

makeworld-the-better-one picture makeworld-the-better-one  路  3Comments

ixevix picture ixevix  路  3Comments

AdrienLemaire picture AdrienLemaire  路  3Comments