Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with makepkg fails with LTO #1527

Closed
simonkrogmann opened this issue Jun 4, 2021 · 4 comments
Closed

Build with makepkg fails with LTO #1527

simonkrogmann opened this issue Jun 4, 2021 · 4 comments

Comments

@simonkrogmann
Copy link

Affected Version

yay-git-10.2.3.r0.g6e70e2a-1
go1.16.4 linux/amd64

Describe the bug

When having LTO enabled in /etc/makepkg.conf, the build fails.

Reproduction Steps

  1. In /etc/makepkg.conf enable lto, e.g.:
    OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)
  2. yay -Sy yay-git

Expected behavior

The Build should succeed.

Output

==> Starting pkgver()...
==> Sources are ready.
==> Making package: yay-git 10.2.3.r0.g6e70e2a-1 (Fri 04 Jun 2021 14:38:33)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Starting build()...
go build -trimpath -mod=readonly -modcacherw -tags six -ldflags '-X "main.yayVersion=10.2.3.r0.g6e70e2a" -X "main.localePath=/usr/share/locale/" -linkmode=external' -buildmode=pie -o yay
go: downloading github.com/Jguer/go-alpm/v2 v2.0.5
go: downloading github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
go: downloading github.com/Morganamilo/go-srcinfo v1.0.0
go: downloading github.com/leonelquinteros/gotext v1.4.0
go: downloading github.com/mikkeloscar/aur v0.0.0-20200113170522-1cb4e2949656
go: downloading github.com/pkg/errors v0.9.1
go: downloading golang.org/x/term v0.0.0-20210503060354-a79de5458b56
go: downloading github.com/stretchr/testify v1.7.0
go: downloading golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
# net
cgo: cannot load DWARF output from $WORK/b082//_cgo_.o: decoding dwarf section info at offset 0x0: too short
# github.com/Jguer/go-alpm/v2
cgo: cannot load DWARF output from $WORK/b038//_cgo_.o: decoding dwarf section info at offset 0x0: too short
make: *** [Makefile:112: yay] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
error making: yay-git
@mythmon
Copy link

mythmon commented Jun 7, 2021

I'm also having this problem when building through yay. Unlike in other issues here, I don't have -flto specified in /etc/makepkg.conf.

My build output looks very similar to @simonkrogmann's

❯ yay -S yay
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  yay-10.2.3-1

:: PKGBUILD up to date, Skipping (1/1): yay
:: (1/1) Parsing SRCINFO: yay
  1 yay                              (Installed) (Build Files Exist)
==> PKGBUILDs to edit?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> 
==> Making package: yay 10.2.3-1 (Mon 07 Jun 2021 08:45:58 AM PDT)
==> Retrieving sources...
  -> Downloading yay-10.2.3.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   118  100   118    0     0    678      0 --:--:-- --:--:-- --:--:--   678
100  346k  100  346k    0     0  1037k      0 --:--:-- --:--:-- --:--:-- 1037k
==> Validating source files with sha256sums...
    yay-10.2.3.tar.gz ... Passed
==> Making package: yay 10.2.3-1 (Mon 07 Jun 2021 08:46:06 AM PDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found yay-10.2.3.tar.gz
==> Validating source files with sha256sums...
    yay-10.2.3.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting yay-10.2.3.tar.gz with bsdtar
==> Sources are ready.
==> Making package: yay 10.2.3-1 (Mon 07 Jun 2021 08:46:20 AM PDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Removing existing $pkgdir/ directory...
==> Starting build()...
go build -trimpath -mod=readonly -modcacherw -tags six -ldflags '-X "main.yayVersion=10.2.3" -X "main.localePath=/usr/share/locale/" -linkmode=external' -buildmode=pie -o yay
go: downloading github.com/Jguer/go-alpm/v2 v2.0.5
go: downloading github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/mikkeloscar/aur v0.0.0-20200113170522-1cb4e2949656
go: downloading github.com/stretchr/testify v1.7.0
go: downloading golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096
go: downloading github.com/Morganamilo/go-srcinfo v1.0.0
go: downloading golang.org/x/term v0.0.0-20210503060354-a79de5458b56
go: downloading github.com/leonelquinteros/gotext v1.4.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
# net
cgo: cannot load DWARF output from $WORK/b082//_cgo_.o: decoding dwarf section info at offset 0x0: too short
# github.com/Jguer/go-alpm/v2
cgo: cannot load DWARF output from $WORK/b038//_cgo_.o: decoding dwarf section info at offset 0x0: too short
make: *** [Makefile:112: yay] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
removing untracked AUR files from cache...
:: Cleaning (1/1): /home/mythmon/.cache/yay/yay
Removing yay-10.2.3.tar.gz
error making: yay

@ikouchiha47
Copy link

Having similar issue.

go build -trimpath -mod=readonly -modcacherw -tags six -ldflags '-X "main.yayVersion=10.2.3" -X "main.localePath=/usr/share/locale/" -linkmode=external' -buildmode=pie -o yay
go: downloading github.com/Jguer/go-alpm/v2 v2.0.5
go: downloading github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
go: downloading github.com/Morganamilo/go-srcinfo v1.0.0
go: downloading github.com/leonelquinteros/gotext v1.4.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/mikkeloscar/aur v0.0.0-20200113170522-1cb4e2949656
go: downloading golang.org/x/term v0.0.0-20210503060354-a79de5458b56
go: downloading github.com/stretchr/testify v1.7.0
go: downloading golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading github.com/davecgh/go-spew v1.1.1
# runtime/cgo
cc1: error: unknown pass libsanitizer specified in '-fdisable'
make: *** [Makefile:112: yay] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

@MrQubo
Copy link

MrQubo commented Aug 3, 2021

For now the fix is to add options=(!lto) to PKGBUILD until go supports lto (see golang/go#43505).

@Jguer
Copy link
Owner

Jguer commented Aug 21, 2021

Added @MrQubo 's proposed fix for now, thanks

@Jguer Jguer closed this as completed Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants