From ef30696dc168a7260df77aaaded478c53042fea7 Mon Sep 17 00:00:00 2001 From: Jason Pepas Date: Sat, 2 May 2020 15:26:49 -0500 Subject: [PATCH] Adding linux/ppc to cgoEnabled in cmd/dist/build.go --- README.md | 36 ++++++++++++++++++++++++++++++++++++ src/cmd/dist/build.go | 1 + 2 files changed, 37 insertions(+) diff --git a/README.md b/README.md index 3dc04a00242bc6..0ae2993eeb9d05 100644 --- a/README.md +++ b/README.md @@ -232,3 +232,39 @@ $ cat cmd/go/internal/cfg/zosarch.go | grep ppc "linux/ppc64": false, "linux/ppc64le": true, ``` + +Ah, in `src/cmd/dist/build.go`, we see this: + +``` +// Cannot use go/build directly because cmd/dist for a new release +// builds against an old release's go/build, which may be out of sync. +// To reduce duplication, we generate the list for go/build from this. +// +// We list all supported platforms in this list, so that this is the +// single point of truth for supported platforms. This list is used +// by 'go tool dist list'. +var cgoEnabled = map[string]bool{ +``` + +Now let's try bootstrapping again. + +``` +$ GOOS=linux GOARCH=ppc ./bootstrap.bash +../../go-linux-ppc-bootstrap already exists; remove before continuing +``` + +Ok, let's clean that up and try again. + +``` +$ rm -rf ../../go-linux-ppc-bootstrap +$ GOOS=linux GOARCH=ppc ./bootstrap.bash +Building packages and commands for host, linux/amd64. +Building packages and commands for target, linux/ppc. +go tool compile: exit status 2 +compile: unknown architecture "ppc" +go tool dist: FAILED: /home/cell/github/pepaslabs/go-linux-ppc-bootstrap/pkg/tool/linux_amd64/go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 1 +``` + +Ok, perhaps I first need to bootstrap `go` for my own platform (with updated `cgoEnabled` map), +and then use that to build `go` for `linux/ppc`. + diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 76036bf99248dc..18a0490b499ce3 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1539,6 +1539,7 @@ var cgoEnabled = map[string]bool{ "linux/amd64": true, "linux/arm": true, "linux/arm64": true, + "linux/ppc": true, "linux/ppc64": false, "linux/ppc64le": true, "linux/mips": true,