Summary: | dev-util/github-cli-2.42.0: link-time dev-lang/go error when -ggdb3 is present in CFLAGS | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | tacokoneko |
Component: | Current packages | Assignee: | William Hubbs <williamh> |
Status: | RESOLVED FIXED | ||
Severity: | trivial | CC: | ionen, lg3dx6fd, sam, tacokoneko, torreemanuele6 |
Priority: | Low | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=924436 https://github.com/gentoo/gentoo/pull/38140 https://bugs.gentoo.org/show_bug.cgi?id=847991 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
/var/tmp/portage/dev-util/github-cli-2.42.0/temp/build.log
emerge -pqv '=dev-util/github-cli-2.42.0::gentoo' |
Description
tacokoneko
2024-02-14 08:25:38 UTC
Created attachment 884929 [details]
/var/tmp/portage/dev-util/github-cli-2.42.0/temp/build.log
Created attachment 884930 [details]
emerge -pqv '=dev-util/github-cli-2.42.0::gentoo'
wrt bug #924436's lazy temporary workaround https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=548e7366 >If this is a widespread issue, it may need visiting in go-env's >go-env_set_compile_environment instead though. As a user-side workaround, could explicitly set CGO_C(XX)FLAGS to not have -g3/-ggdb3 though. Likely only surfacing now because it used to not respect *FLAGS before go-env.eclass I think? (not sure what Go does without it), assuming it's not just a new issue with a new Go version. I've got the same bug with github-cli , docker-compose , app-shells/fzf . setting CGO_CFLAGS="${COMMON_FLAGS}" CGO_CXXFLAGS="${COMMON_FLAGS}" CGO_FFLAGS="${COMMON_FLAGS}" where COMMON_FLAGS doesn't contain -ggdb3 solve the compile issue. Thanks for proposed used-side solution. (Posting since the bug is still Status: UNCONFIRMED) I've also just encoutered this bug when re-building dev-util/github-cli after the recent dev-lang/go update. The cause of the problem was indeed me adding -ggdb3 to my global CFLAGS and CXXFLAGS since the last installation. My temporary fix is removing -ggdb3 from CFLAGS when building this package using: $ cat /etc/portage/env/noggdb3 CFLAGS="${COMMON_FLAGS}" $ grep github-cli /etc/portage/package.env dev-util/github-cli noggdb3 Error message: GOROOT='' /usr/lib/go/pkg/tool/linux_amd64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -installsuffix shared -X=runtime.godebugDefault=asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1 -buildmode=pie -buildid=Sz568u9plDhJfnzE2jyi/SEQR9_4SXsWozKvXGQyJ/NavXMej7WJD-4NgK9iY8/Sz568u9plDhJfnzE2jyi -X github.com/cli/cli/v2/internal/build.Date=2024-08-14 -X github.com/cli/cli/v2/internal/build.Version=v2.52.0 -extld=x86_64-pc-linux-gnu-gcc $WORK/b001/_pkg_.a # github.com/cli/cli/v2/cmd/gh loadelf: $WORK/b163/_pkg_.a(_x001.o): 983185: sym#50 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b163/_pkg_.a(_x002.o): 983189: sym#61 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b163/_pkg_.a(_x003.o): 983194: sym#63 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b163/_pkg_.a(_x004.o): 983198: sym#59 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b163/_pkg_.a(_x005.o): 983203: sym#83 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b163/_pkg_.a(_x006.o): 983208: sym#117 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x001.o): 983212: sym#48 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x002.o): 983216: sym#24 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x003.o): 983221: sym#64 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x004.o): 983228: sym#66 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x005.o): 983243: sym#88 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x006.o): 983253: sym#98 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x007.o): 983260: sym#72 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x008.o): 983265: sym#64 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x009.o): 983270: sym#84 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x010.o): 983275: sym#74 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x011.o): 983280: sym#64 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x012.o): 983288: sym#67 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b172/_pkg_.a(_x013.o): 983293: sym#76 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b210/_pkg_.a(_x001.o): 983301: sym#48 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) loadelf: $WORK/b210/_pkg_.a(_x002.o): 983306: sym#65 ("wm4.0.0e9cb841a877bcf5cacaa6a62ce29303"): ignoring symbol in section 1 (".group") (type 0) /usr/lib/go/pkg/tool/linux_amd64/link: too many errors exit status 1 build.go: building task `bin/gh` failed. make: *** [Makefile:17: bin/gh] Error 1 I read the ebuild for this package and I was surprised to find a filter-flags "-ggdb3" command that clearly is not doing what it is supposed to do. I did some digging, and I have found that that filter-flags command as well as the filter-lto and unset LDFLAGS that are also called in src_compile, are seeming completely useless, because GOC_LDFLAGS, GOC_CFLAGS, and the other GOC_*FLAGS variables are set earlier on in src_unpack by go-env_set_compile_environment . I made a pull request that fixes this bug (and probably also bugs related to lto if thoes unset LDFLAGS and filter-lto commands were actually needed.) https://github.com/gentoo/gentoo/pull/38140 o/ emanuele6 The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b05c1c26ef96bb9324db626572f3c4a73e3178c commit 8b05c1c26ef96bb9324db626572f3c4a73e3178c Author: Emanuele Torre <torreemanuele6@gmail.com> AuthorDate: 2024-08-14 05:36:34 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-15 21:18:22 +0000 dev-util/github-cli: fix build failure when -ggdb3 is in CFLAGS After experiencing the bug described in https://bugs.gentoo.org/924496, I was surprised to see filter-flags "-ggdb3" in the ebuilds for this package. I did some digging and found that go's goc does not use CFLAGS, LDFLAGS, etc by default; it only uses the GOC_*FLAGS environment variables. What causes goc to use CFLAGS if GOC_FLAGS is unset or empty is the go-env_set_compile_environment function from the go-env eclass, that is indirectly called by the go-module_live_vendor and go-module_src_unpack functions from the go-module eclass that are being called from the src_unpack of this ebuild. So, calling filter-lto , filter-flags "-ggdb3" , and unset LDFLAGS from src_compile before emake seems completely useless since those will only filter regular *FLAGS environment variable, and not the GOC_*FLAGS environment variables initialised from the *FLAGS variables earlier on in src_unpack. Moving those filter/unset commands to the start of src_unpack makes them filter/unset *FLAGS variables before GOC_*FLAGS variables are set, and actually fix the build problem encountered when CFLAGS contains -ggdb3. Bump copyright of touched ebuild files. Bug: https://bugs.gentoo.org/847991 Closes: https://bugs.gentoo.org/924496 Signed-off-by: Emanuele Torre <torreemanuele6@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/38140 Signed-off-by: Sam James <sam@gentoo.org> dev-util/github-cli/github-cli-2.27.0.ebuild | 15 ++++++++------- dev-util/github-cli/github-cli-2.31.0.ebuild | 15 ++++++++------- dev-util/github-cli/github-cli-2.32.1.ebuild | 15 ++++++++------- dev-util/github-cli/github-cli-2.33.0.ebuild | 15 ++++++++------- dev-util/github-cli/github-cli-2.42.0.ebuild | 13 +++++++------ dev-util/github-cli/github-cli-2.52.0.ebuild | 13 +++++++------ dev-util/github-cli/github-cli-9999.ebuild | 15 ++++++++------- 7 files changed, 54 insertions(+), 47 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc1c525c544f7c4e4bc4a51ab71f7755e592eeef commit fc1c525c544f7c4e4bc4a51ab71f7755e592eeef Author: Sam James <sam@gentoo.org> AuthorDate: 2024-08-15 21:11:24 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-15 21:18:23 +0000 dev-util/github-cli: drop now-obsolete flag mangling The real issue is intrinsic to Go (or cgo, anyway) and so we shouldn't do it per-package, but rather in go-env.eclass. That's done now, so drop the package-local workaround. Bug: https://bugs.gentoo.org/924496 Signed-off-by: Sam James <sam@gentoo.org> dev-util/github-cli/github-cli-2.27.0.ebuild | 9 +-------- dev-util/github-cli/github-cli-2.31.0.ebuild | 9 +-------- dev-util/github-cli/github-cli-2.32.1.ebuild | 9 +-------- dev-util/github-cli/github-cli-2.33.0.ebuild | 9 +-------- dev-util/github-cli/github-cli-2.42.0.ebuild | 9 +-------- dev-util/github-cli/github-cli-2.52.0.ebuild | 9 +-------- dev-util/github-cli/github-cli-9999.ebuild | 9 +-------- 7 files changed, 7 insertions(+), 56 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=116f54058abd4fa4a5b3c16ee49a99df11883a45 commit 116f54058abd4fa4a5b3c16ee49a99df11883a45 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-08-15 21:13:28 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-15 21:18:23 +0000 go-env.eclass: workaround debug info issues Go can't handle some DWARF produced by GCC but nobody's been able to produce a simple testcase for it, so add a workaround where we replace -g3 with -g and -ggdb3 with -ggdb for GCC, like Ionen did in Kitty. Bug: https://bugs.gentoo.org/847991 Bug: https://bugs.gentoo.org/924436 Bug: https://bugs.gentoo.org/924496 Closes: https://bugs.gentoo.org/929219 Signed-off-by: Sam James <sam@gentoo.org> eclass/go-env.eclass | 6 ++++++ 1 file changed, 6 insertions(+) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f754863ff91dc4dca11e6a5217ffd449f39c74c commit 1f754863ff91dc4dca11e6a5217ffd449f39c74c Author: Sam James <sam@gentoo.org> AuthorDate: 2024-08-15 21:23:22 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-15 21:24:05 +0000 go-env.eclass: improve debug workaround Use what Ionen did in x11-terms/kitty to avoid touching flags for non-Go parts of the build. Bug: https://bugs.gentoo.org/847991 Bug: https://bugs.gentoo.org/924436 Bug: https://bugs.gentoo.org/924496 Bug: https://bugs.gentoo.org/929219 Signed-off-by: Sam James <sam@gentoo.org> eclass/go-env.eclass | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) |