Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 929219 - dev-lang/go rebuilding packages fails with "ignoring symbol" errors with -ggdb3 in CFLAGS?
Summary: dev-lang/go rebuilding packages fails with "ignoring symbol" errors with -ggd...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 14:14 UTC by Zack Weinberg
Modified: 2024-08-15 21:24 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info '=dev-util/hut-0.3.0::guru' output (emerge-info-dev-util-hut-0.3.0.txt,7.63 KB, text/plain)
2024-04-12 14:14 UTC, Zack Weinberg
Details
Build log (dev-util-hut-0.3.0-build.log,342.81 KB, text/plain)
2024-04-12 14:16 UTC, Zack Weinberg
Details
ebuild environment file (dev-util-hut-0.3.0-environment.txt,81.57 KB, text/plain)
2024-04-12 14:17 UTC, Zack Weinberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zack Weinberg 2024-04-12 14:14:54 UTC
Created attachment 890493 [details]
emerge --info '=dev-util/hut-0.3.0::guru' output

# emerge --oneshot @golang-rebuild

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

Calculating dependencies... done!
Dependency resolution took 2.51 s (backtrack: 0/20).

[ebuild   R    ] dev-lang/go-1.22.2
[ebuild   R   ~] dev-util/hut-0.3.0

Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
>>> Emerging (1 of 2) dev-lang/go-1.22.2::gentoo
>>> Installing (1 of 2) dev-lang/go-1.22.2::gentoo
>>> Completed (1 of 2) dev-lang/go-1.22.2::gentoo
>>> Emerging (2 of 2) dev-util/hut-0.3.0::guru
>>> Failed to emerge dev-util/hut-0.3.0, Log file:
>>>  '/var/cache/portage-build/portage/dev-util/hut-0.3.0/temp/build.log'

The build log seems to be fine until

/usr/lib/go/pkg/tool/linux_amd64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -installsuffix shared -X=runtime.godebugDefault=httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1 -buildmode=pie -buildid=Gkk-FhAuFQMlliwkPnLj/mPYc6Ro8O7IMVuX4wstV/jMqi8GO5YmaQpVZmhY2p/Gkk-FhAuFQMlliwkPnLj -extld=x86_64-pc-linux-gnu-gcc $WORK/b001/_pkg_.a
# git.sr.ht/~emersion/hut
loadelf: $WORK/b083/_pkg_.a(_x001.o): 262879: sym#50 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b083/_pkg_.a(_x002.o): 262883: sym#60 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b083/_pkg_.a(_x003.o): 262888: sym#62 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b083/_pkg_.a(_x004.o): 262892: sym#58 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b083/_pkg_.a(_x005.o): 262897: sym#82 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b083/_pkg_.a(_x006.o): 262902: sym#116 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x001.o): 262906: sym#48 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x002.o): 262910: sym#24 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x003.o): 262915: sym#64 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x004.o): 262922: sym#66 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x005.o): 262937: sym#88 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x006.o): 262947: sym#98 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x007.o): 262954: sym#71 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x008.o): 262959: sym#64 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x009.o): 262964: sym#84 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x010.o): 262969: sym#74 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x011.o): 262974: sym#64 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x012.o): 262982: sym#67 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b053/_pkg_.a(_x013.o): 262987: sym#76 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b051/_pkg_.a(_x001.o): 262995: sym#48 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
loadelf: $WORK/b051/_pkg_.a(_x002.o): 263000: sym#65 ("wm4.0.2372d742cf9d71a2d959588100540dba"): ignoring symbol in section 1 (".group") (type 0)
/usr/lib/go/pkg/tool/linux_amd64/link: too many errors
 * ERROR: dev-util/hut-0.3.0::guru failed (compile phase):
 *   go build failed

This is a guru package, but it looks like a problem with the go toolchain rather than the package, so I'm filing it here.

# emerge -pqv '=dev-util/hut-0.3.0::guru'
[ebuild   R   ] dev-util/hut-0.3.0
Comment 1 Zack Weinberg 2024-04-12 14:16:58 UTC
Created attachment 890494 [details]
Build log
Comment 2 Zack Weinberg 2024-04-12 14:17:15 UTC
Created attachment 890495 [details]
ebuild environment file
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-12 14:18:49 UTC
Someone tried to debug this with me in #gentoo a few months ago but I was quite tired, and they ended up coming back saying they stopped building dev-lang/go (and maybe some other packages?) w/o -ggdb3 and then Everything Was Fine.

Fairly sure it's new with go-1.22 or maybe go-1.21.

I don't think I managed to reproduce it at the time though.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-12 14:19:13 UTC
Ah, wait, maybe a dupe of bug 924496 -- where https://bugs.gentoo.org/924496#c3 mentions why it may have started (so maybe not a new go bug, but newly surfaced in ebuilds).
Comment 5 Zack Weinberg 2024-04-12 15:10:31 UTC
The workaround in https://bugs.gentoo.org/924496#c4 is effective.  Specifically, I now have this in /etc/portage/make.conf

COMMON_FLAGS="-O2 -march=native -pipe"
CFLAGS="-ggdb3 ${COMMON_FLAGS}"
CXXFLAGS="-ggdb3 ${COMMON_FLAGS}"
FCFLAGS="-ggdb3 ${COMMON_FLAGS}"
FFLAGS="-ggdb3 ${COMMON_FLAGS}"
CGO_CFLAGS="-g ${COMMON_FLAGS}"
CGO_CXXFLAGS="-g ${COMMON_FLAGS}"
CGO_FFLAGS="-g ${COMMON_FLAGS}"

and emerge @golang-rebuild now succeeds for me.

I know absolutely nothing about Go, but am happy to do further experiments if given step by step instructions.
Comment 6 Larry the Git Cow gentoo-dev 2024-08-15 21:18:43 UTC
The bug has been closed via the following commit(s):

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(+)
Comment 7 Larry the Git Cow gentoo-dev 2024-08-15 21:24:19 UTC
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(-)