New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 712784 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2017
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 711461



Sign in to add a comment

binutils-2.27: dev-lang/go fails to build

Project Member Reported by rahulchaudhry@chromium.org, Apr 18 2017

Issue description

dev-lang/go (as well as the cross-compiler packages cross-x86_64-cros-linux-gnu/go and cross-armv7a-cros-linux-gnueabi/go) fail to build with binutils-2.27 emerged into the chroot:

The ebuild fails with:

# os/user
cannot load DWARF output from $WORK/os/user/_obj//_cgo_.o: decoding dwarf section info at offset 0x4: unsupported version 0
# net
cannot load DWARF output from $WORK/net/_obj//_cgo_.o: decoding dwarf section info at offset 0x4: unsupported version 0

 
This is essentially http://golang.org/issue/11773

Newer versions of binutils compress debug sections for linux/x86 by default.
The exact change happened on 12/14/2014 (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=89e7505fcde4bd83948f559f429a0e1eb4262f05).
The default is uncompressed debug sections for binutils 2.25, and compressed debug sections for binutils 2.26 and later.

Compressed debug sections are not supported by older versions of the Go toolchain.
Support was added on 12/03/2015 (http://golang.org/cl/17341).
Compressed debug sections are only supported by Go 1.6 or later.

We use Go 1.4 to bootstrap the build for the latest release of Go.
The bootstrap compiler fails to build with newer version of binutils installed in the chroot.
The issue only shows up when using Cgo.
Build fails while building the standard library packages that use Cgo (e.g. "os/user" and "net").

I see atleast 3 alternatives to fix this:

1) Change the binutils default back to uncompressed debug sections using a local patch. This will affect all packages (not just dev-lang/go) and preserve the behavior of the current version of binutils we use in ChromiumOS (2.25). On the negative side, we'll miss out on the debug-info-size reductions across the board that would have come with the binutils upgrade.

2) Backport the support for compressed debug sections to Go 1.4 using a local patch. While this seems doable, it seems like an overkill to backport and maintain patches to a compiler that's only used to bootstrap the latest release.

3) Disable Cgo when building the bootstrap compiler. It's only used to build the latest release, and the latest release can still be built with Cgo enabled since it supports compressed debug sections. This seems to be the simplest fix: https://chromium-review.googlesource.com/#/c/482599
I like 3)

how much savings are we getting by compressed debug sections?
I haven't checked yet. Will evaluate this at a later stage once all the build issues are fixed.

Comment 4 by vapier@chromium.org, Apr 20 2017

on the sdk side, i don't think we'd save too much disk space.  we're using <200MB in /usr/lib/debug.

on the board side, we would save space when the debug files are installed.  but we also set up some logic to speed that up by not downloading in the first place.  pretty sure we're talking hundreds of megs per sysroot.

might be interesting to see about cpu usage overhead ...
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/a331ad33b8d4ddf088225aae1602e57c77cc3ca0

commit a331ad33b8d4ddf088225aae1602e57c77cc3ca0
Author: Rahul Chaudhry <rahulchaudhry@chromium.org>
Date: Sat Apr 22 04:57:35 2017

dev-lang/go: disable Cgo when building the bootstrap compiler.

Newer versions of binutils (>= binutils 2.26) compress debug sections
for linux/x86 by default. Compressed debug sections are not supported
by older versions of the Go toolchain (< go1.6).

We use Go 1.4 to bootstrap the build for the latest release of Go.
The bootstrap compiler fails to build with newer version of binutils
installed in the chroot.

The issue only shows up when using Cgo. Build fails while building the
standard library packages that use Cgo (e.g. "os/user" and "net").

This change disables Cgo when building the bootstrap compiler. The
bootstrap compiler is only used to build the latest release. There
is no change for building the latest release, i.e. the host and
cross compilers installed in the chroot still have Cgo enabled.

BUG= chromium:712784 
TEST='sudo emerge dev-lang/go' succeeded with binutils 2.27 installed in the chroot.

Change-Id: I7517fe368496515c312e0360fd5c2f8f5be823c6
Reviewed-on: https://chromium-review.googlesource.com/482599
Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org>
Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
Reviewed-by: Rahul Chaudhry <rahulchaudhry@chromium.org>

[modify] https://crrev.com/a331ad33b8d4ddf088225aae1602e57c77cc3ca0/dev-lang/go/go-1.8.1.ebuild
[add] https://crrev.com/a331ad33b8d4ddf088225aae1602e57c77cc3ca0/dev-lang/go/go-1.8.1-r1.ebuild

Status: Fixed (was: Assigned)

Comment 7 by dchan@google.com, May 30 2017

Labels: VerifyIn-60

Comment 8 by dchan@chromium.org, Aug 1 2017

Labels: VerifyIn-61
Status: Verified (was: Fixed)
Closing. Please reopen it if its not fixed. Thanks!

Sign in to add a comment