Skip to content

cmd/dist: use GOHOSTARCH/GOHOSTOS instead of GOOS/GOARCH for host libraries and binaries #6559

Description

@rsc
If you are, say, on a Mac, and you 

cd src/pkg/runtime
GOOS=linux make

then cmd/dist correctly builds the linux copy of runtime.a.

However, if you 

cd src/cmd/6l
GOOS=linux make

then cmd/dist incorrectly tries to build a "linux" copy of 6l (and fails,
beacuse the "linux" copies of the libraries don't exist). It should be
building the darwin copy, because GOHOSTOS is darwin.

The make.bash sequence sets GOHOSTOS=GOOS and GOHOSTARCH=GOARCH during the builds in
those directories, so it hasn't come up in that context. However, if you are working on
a cross-compiled system it's annoying that you can't leave GOOS set to the target
system. Every time you build a host tool you need to set it back.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions