Go 1.8 port to FreeBSD/PowerPC64

211 views
Skip to first unread message

Curtis Hamilton

unread,
May 31, 2019, 9:54:55 PM5/31/19
to golang-nuts
I’m porting Go 1.8 to FreeBSD/PowerPC64. I’ve successfully built go-FreeBSD-ppc64-bootstrap using go on FreeBSD/amd64.

However, l’m getting the error go: cannot find GOROOT directory, when executing ‘go env’ on the target system.

I’m not sure if this is a code issue. I’ve tried some of the tips about setting GOROOT and GOPATH, with no success.

Can someone help?

Ian Lance Taylor

unread,
Jun 3, 2019, 2:17:13 AM6/3/19
to Curtis Hamilton, golang-nuts
Why not port a newer version of Go?

What exactly are you doing? In particular, are you using
src/bootstrap.bash? Show us the exact commands that you are running,
and the exact unexpected output that you are getting.

Ian

B Carr

unread,
Jun 3, 2019, 8:51:48 AM6/3/19
to golang-nuts

I'm wondering what you are trying to do as well. Go (latest version) is already available in the ports collection for FreeBSD. Installs just fine.



On Friday, May 31, 2019 at 7:54:55 PM UTC-6, Curtis Hamilton wrote:
I’m porting Go 1.8 to FreeBSD/PowerPC64.  I’ve successfully built go-FreeBSD-ppc64-bootstrap using go on FreeBSD/amd64.

Can someone help?

Curtis Hamilton

unread,
Jun 3, 2019, 11:14:06 PM6/3/19
to golang-nuts
I modified the freebsd/amd64 Go code and linux/ppc64 specific assembly code for freebsd/ppc64.

With that done, I used the following to cross-compile on freebsd/amd64 host to create the bootstrap:

env GOOS=freebsd GOARCH=ppc64 GOROOT_BOOTSTRAP=/usr/local/go ./bootstrap.bash

I placed the resulting bootstrap build on freebsd/powerpc64 target and from the go-freebsd-ppc64-bootstrap directory:

Command-line: bin/go

Results:

Go is a tool for managing Go source code.

Usage:

go <command> [arguments]

The commands are:

bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
generate generate Go files by processing source
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages or modules
mod module maintenance
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet report likely mistakes in packages

Use "go help <command>" for more information about a command.

Additional help topics:

buildmode build modes
c calling between Go and C
cache build and test caching
environment environment variables
filetype file types
go.mod the go.mod file
gopath GOPATH environment variable
gopath-get legacy GOPATH go get
goproxy module proxy protocol
importpath import path syntax
modules modules, module versions, and more
module-get module-aware go get
packages package lists and patterns
testflag testing flags
testfunc testing functions

Use "go help <topic>" for more information about that topic.

Command-line: bin/go env

Results:

go: cannot find GOROOT directory: /usr/ports/tmp/go-freebsd-ppc64-bootstrap

Setting GOROOT to go-freebsd-ppc64-bootstrap (or any other location), does not resolve the problem. I know that it is finds the "environment", setting because whatever I set it to is returned when I execute bin/go env.

Curtis Hamilton

unread,
Jun 3, 2019, 11:21:07 PM6/3/19
to golang-nuts
Currently. the FreeBSD port only supports "i386 amd64 armv6 armv7" and does not support powerpc64 (ppc64). I'm starting with an older version because newer versions seem to only support power8, while I'm using power5.

Steven Hartland

unread,
Jun 4, 2019, 3:48:36 AM6/4/19
to Curtis Hamilton, golang-nuts
Newer versions of go require an older version of go (1.4) to bootstrap,
that may be related to your issue?

Curtis Hamilton

unread,
Jun 4, 2019, 10:07:54 AM6/4/19
to golang-nuts
I don’t believe that’s related to the issue. I’m able to build the bootstrap, but having an issue getting it to recognize the environment.

Curtis Hamilton

unread,
Jun 10, 2019, 2:27:27 PM6/10/19
to golang-nuts
I’ve resolved my issue and now have a working copy of Go.

Unfortunately, this version (1.8.7) is the last version that openly supports Power5. Mikael Urankar has ported 1.12.5 to PowerPC64, however, when I attempt to build this version I encounter “illegal instruction”, indicating that unsupported Power8(?) code has been encountered.

https://reviews.freebsd.org/p/mikael.urankar_gmail.com/
Reply all
Reply to author
Forward
0 new messages