Skip to content

cmd/dist: overwrites $GOROOT_BOOTSTRAP/pkg/xxx/math/big.a #22187

Description

@rsc

cmd/dist does

$GOROOT_BOOTSTRAP/bin/go install -gcflags -l -tags math_big_pure_go bootstrap/cmd/...

The intended effect of the tags is to set them for building bootstrap/math/big. But they may also be present in $GOROOT_BOOTSTRAP/src/math/big, which will change the set of files used for the standard (that is, standard in $GOROOT_BOOTSTRAP) math/big. The change in the file set will - in Go 1.5 and later - make the standard math/big look out of date, which will cause it to be recompiled and reinstalled.

There are two problems here: (1) the user may not have write access to $GOROOT_BOOTSTRAP, and (2) installing the new math/big.a will make math/big.a look out of date to a regular $GOROOT_BOOTSTRAP/bin/go command not using those tags. One example of situation (1) is when using the default Ubuntu install of Go as GOROOT_BOOTSTRAP.

The fix here is probably to also specify -pkgdir as well pointing at a temporary location (wherever we wrote the bootstrap src would be fine). That will have the unfortunate effect of recompiling the entire $GOROOT_BOOTSTRAP standard library, adding maybe 10 seconds to the build, but it will ensure that nothing is ever written to $GOROOT_BOOTSTRAP/pkg during cmd/dist.

Prior to Go 1.8, the command was just "install -gcflags -l bootstrap/cmd/...", which would not recompile math/big, because the staleness computation doesn't know what compile flags were used. CL 31142 (/cc @mundaym @randall77), which was released in Go 1.8, added the -tags argument and caused these spurious rebuilds.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions