New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: "internal compiler error: weird decoding" on Raspberry Pi with Go 1.11 #27228

Open
mooneyr opened this Issue Aug 26, 2018 · 32 comments

Comments

Projects
None yet
10 participants
@mooneyr

mooneyr commented Aug 26, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.11

Does this issue reproduce with the latest release?

this is the latest release

What operating system and processor architecture are you using (go env)?

raspbian stretch - up to date kernel as of today
ARM6 and ARM7 - Raspberry Pi B and Raspberry Pi 3B

What did you do?

ran ./all.bash

If possible, provide a recipe for reproducing the error.

Just try compiling the latest version on a Raspberry Pi
Compiled using go1.4

What did you expect to see?

A compiled version of go1.11

What did you see instead?

Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
/usr/local/go/src/bytes/buffer.go:280:7: internal compiler error: weird decoding: 254, true => 129

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
go tool dist: FAILED: /usr/local/go/pkg/tool/linux_arm/compile -std -pack -o /tmp/go-tool-dist-682140403/bytes/_go_.a -p bytes /usr/local/go/src/bytes/buffer.go /usr/local/go/src/bytes/bytes.go /usr/local/go/src/bytes/bytes_decl.go /usr/local/go/src/bytes/reader.go: exit status 2
xxx@xxx:/usr/local/go/src $ /usr/local/go/src/strings/builder.go:100:7: internal compiler error: weird decoding: 254, true => 129

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
can't create /tmp/go-tool-dist-682140403/hash/adler32/_go_.a: open /tmp/go-tool-dist-682140403/hash/adler32/_go_.a: no such file or directory
can't create /tmp/go-tool-dist-682140403/math/_go_.a: open /tmp/go-tool-dist-682140403/math/_go_.a: no such file or directory
can't create /tmp/go-tool-dist-682140403/hash/crc32/_go_.a: open /tmp/go-tool-dist-682140403/hash/crc32/_go_.a: no such file or directory
can't create /tmp/go-tool-dist-682140403/syscall/_go_.a: open /tmp/go-tool-dist-682140403/syscall/_go_.a: no such file or directory

@bradfitz bradfitz changed the title from Go compile crash on Raspberry Pi to cmd/compile: Go compiler crash on Raspberry Pi with Go 1.11 Aug 26, 2018

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 26, 2018

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 26, 2018

Bootstrap with Go 1.10 works at least (on Raspberry Pi Model B Plus Rev 1.2, also on Raspbian Stretch), up until I run out of memory:

pi@pibar ~/go/src $ GOROOT_BOOTSTRAP=$HOME/go1.10 ./make.bash
Building Go cmd/dist using /home/pi/go1.10.
Building Go toolchain1 using /home/pi/go1.10.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
warning: GOPATH set to GOROOT (/home/pi/go/) has no effect
# cmd/compile/internal/ssa
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x4da1b1, 0x16)
	/home/pi/go/src/runtime/panic.go:616 +0x60
runtime.sysMap(0x26d80000, 0x100000, 0x72f101, 0x74a288)
	/home/pi/go/src/runtime/mem_linux.go:227 +0x11c
@agnivade

This comment has been minimized.

Member

agnivade commented Aug 26, 2018

@bradfitz - I think you may be experiencing #26523.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 26, 2018

@mooneyr, can you post the full output, starting with ./all.bash or ./make.bash?

Which Go 1.4 are you using?

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 26, 2018

/cc @griesemer too for the "weird decoding" importer error.

@randall77

This comment has been minimized.

Contributor

randall77 commented Aug 26, 2018

This looks like the new binary importer is failing (maybe for the utf8 package?) because the file is corrupted.
Not sure why that would happen.
@mdempsky

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 26, 2018

Never discount that Raspberry Pis eat most SD cards for breakfast.

@mooneyr

This comment has been minimized.

mooneyr commented Aug 27, 2018

@bradfitz
It's 2 Raspberry Pis with the same problem - it's exceedingly unlikely that it's the sdcard.
It's 3 separate git fetches - I erased and recloned the repo after discovering the first problem - that makes download corruption also unlikely.
I've been compiling every version since 1.6 using 1.4 to bootstrap without this issue until 1.11
using go1.4.1 to bootstrap

complete output follows:
xxx@xxx:/usr/local/go/src $ ./all.bash
Building Go cmd/dist using /home/xxx/go1.4.
Building Go toolchain1 using /home/xxx/go1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
/usr/local/go/src/bytes/buffer.go:280:7: internal compiler error: weird decoding
: 254, true => 129

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
go tool dist: FAILED: /usr/local/go/pkg/tool/linux_arm/compile -std -pack -o /tm
p/go-tool-dist-940254599/bytes/go.a -p bytes /usr/local/go/src/bytes/buffer.go
/usr/local/go/src/bytes/bytes.go /usr/local/go/src/bytes/bytes_decl.go /usr/loc
al/go/src/bytes/reader.go: exit status 2
go tool dist: open /tmp/go-tool-dist-940254599/math/cbrt_stub.o: no such file or
directory
/usr/local/go/src/strings/builder.go💯7: internal compiler error: weird decod
ing: 254, true => 129

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
xxx@xxx:/usr/local/go/src $ can't create /tmp/go-tool-dist-940254599/syscall/_go
_.a: open /tmp/go-tool-dist-940254599/syscall/go.a: no such file or directory

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 27, 2018

It's 2 Raspberry Pis with the same problem - it's exceedingly unlikely that it's the sdcard.

Fair enough. I'm just scarred from many destroyed SD cards over the years.

Where did you get your Go 1.4.1? Did you build it from source on the same Raspberry Pi? Or was it a binary download from somewhere?

@mooneyr

This comment has been minimized.

mooneyr commented Aug 28, 2018

Where did you get your Go 1.4.1?

I honestly can't remember how I came by it, it was that long ago. All the versions I have on the separate raspberries are the same source though. Guess I can try compiling 1.4 again and try that version to bootstrap 1.11.
I'll also try recompiling 1.10 with the 1.4.1 I have and let you know the results of both.

@mooneyr

This comment has been minimized.

mooneyr commented Aug 30, 2018

I've recompiled go1.10 using my existing go1.4 to bootstrap, it works.
I've recompiled go1.4 on the Pi3B, that worked.
I've used the newly compiled go1.4 to attempt to compile go1.11 and get the same error as before - weird decoding: 254, true => 129

@FiloSottile FiloSottile added this to the Go1.12 milestone Aug 30, 2018

@FiloSottile FiloSottile changed the title from cmd/compile: Go compiler crash on Raspberry Pi with Go 1.11 to cmd/compile: "internal compiler error: weird decoding" on Raspberry Pi with Go 1.11 Aug 30, 2018

@benshi001

This comment has been minimized.

Member

benshi001 commented Sep 4, 2018

I can not reproduce this issue with
raspberrypi 2 model B
go1.10.4 as bootstrap
building the newest go master branch

maybe you can try adding a USB disk as a SWAP partition?

Here is my log

pi@raspberrypi ~/build/go/src $ GOROOT_BOOTSTRAP=~/go/ ./all.bash 
Building Go cmd/dist using /home/pi/go/.
Building Go toolchain1 using /home/pi/go/.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/arm.

##### Testing packages.
ok  	archive/tar	0.505s
ok  	archive/zip	36.918s
ok  	bufio	0.803s
ok  	bytes	5.375s
ok  	compress/bzip2	0.671s
ok  	compress/flate	10.959s
ok  	compress/gzip	0.288s
ok  	compress/lzw	0.151s
ok  	compress/zlib	0.292s
ok  	container/heap	0.092s
ok  	container/list	0.031s
ok  	container/ring	0.067s
ok  	context	3.105s
ok  	crypto	0.021s
ok  	crypto/aes	0.135s
ok  	crypto/cipher	0.050s
ok  	crypto/des	0.107s
ok  	crypto/dsa	0.117s
ok  	crypto/ecdsa	2.296s
ok  	crypto/elliptic	0.357s
ok  	crypto/hmac	0.050s
ok  	crypto/internal/subtle	0.054s
ok  	crypto/md5	0.079s
ok  	crypto/rand	0.653s
ok  	crypto/rc4	0.669s
ok  	crypto/rsa	1.278s
ok  	crypto/sha1	0.046s
ok  	crypto/sha256	0.043s
ok  	crypto/sha512	0.086s
ok  	crypto/subtle	0.049s
ok  	crypto/tls	16.290s
ok  	crypto/x509	21.158s
ok  	database/sql	1.237s
ok  	database/sql/driver	0.020s
ok  	debug/dwarf	0.141s
ok  	debug/elf	3.112s
ok  	debug/gosym	0.075s
ok  	debug/macho	0.047s
ok  	debug/pe	0.146s
ok  	debug/plan9obj	0.100s
ok  	encoding/ascii85	0.059s
ok  	encoding/asn1	0.110s
ok  	encoding/base32	0.230s
ok  	encoding/base64	0.125s
ok  	encoding/binary	0.038s
ok  	encoding/csv	0.127s
ok  	encoding/gob	0.422s
ok  	encoding/hex	0.054s
ok  	encoding/json	4.920s
ok  	encoding/pem	0.233s
ok  	encoding/xml	0.266s
ok  	errors	0.080s
ok  	expvar	0.164s
ok  	flag	0.035s
ok  	fmt	1.287s
ok  	go/ast	0.052s
ok  	go/build	2.224s
ok  	go/constant	0.043s
ok  	go/doc	0.970s
ok  	go/format	0.065s
ok  	go/importer	1.076s
ok  	go/internal/gccgoimporter	0.183s
ok  	go/internal/gcimporter	9.014s
ok  	go/internal/srcimporter	9.647s
ok  	go/parser	0.409s
ok  	go/printer	3.274s
ok  	go/scanner	0.088s
ok  	go/token	0.367s
ok  	go/types	12.167s
ok  	hash	0.087s
ok  	hash/adler32	0.138s
ok  	hash/crc32	0.067s
ok  	hash/crc64	0.073s
ok  	hash/fnv	0.067s
ok  	html	0.049s
ok  	html/template	0.533s
ok  	image	2.885s
ok  	image/color	0.192s
ok  	image/draw	0.817s
ok  	image/gif	6.021s
ok  	image/jpeg	3.350s
ok  	image/png	0.795s
ok  	index/suffixarray	0.140s
ok  	internal/cpu	0.050s
ok  	internal/poll	0.404s
ok  	internal/singleflight	0.091s
ok  	internal/trace	23.957s
ok  	io	0.154s
ok  	io/ioutil	0.046s
ok  	log	0.103s
ok  	log/syslog	1.314s
ok  	math	0.059s
ok  	math/big	36.488s
ok  	math/bits	0.144s
ok  	math/cmplx	0.028s
ok  	math/rand	2.530s
ok  	mime	0.112s
ok  	mime/multipart	6.226s
ok  	mime/quotedprintable	2.238s
ok  	net	7.019s
ok  	net/http	54.075s
ok  	net/http/cgi	8.081s
ok  	net/http/cookiejar	0.129s
ok  	net/http/fcgi	0.072s
ok  	net/http/httptest	0.579s
ok  	net/http/httptrace	0.091s
ok  	net/http/httputil	0.621s
ok  	net/http/internal	0.070s
ok  	net/http/pprof	2.110s
ok  	net/internal/socktest	0.026s
ok  	net/mail	0.051s
ok  	net/rpc	0.411s
ok  	net/rpc/jsonrpc	0.245s
ok  	net/smtp	0.260s
ok  	net/textproto	0.040s
ok  	net/url	0.106s
ok  	os	1.623s
ok  	os/exec	3.649s
ok  	os/signal	5.811s
ok  	os/user	0.035s
ok  	path	0.048s
ok  	path/filepath	0.331s
ok  	reflect	1.717s
ok  	regexp	2.107s
ok  	regexp/syntax	11.942s
--- FAIL: TestTimePprof (0.33s)
    crash_test.go:95: testprog TimeProf exit status: signal: segmentation fault
    crash_test.go:633: : open : no such file or directory
        failed to fetch any source profiles
    crash_test.go:635: exit status 1
FAIL
FAIL	runtime	183.807s
ok  	runtime/debug	0.174s
ok  	runtime/internal/atomic	0.829s
ok  	runtime/internal/sys	0.043s
ok  	runtime/pprof	41.843s
ok  	runtime/pprof/internal/profile	0.022s
ok  	runtime/trace	25.705s
ok  	sort	0.537s
ok  	strconv	5.005s
ok  	strings	3.500s
ok  	sync	1.925s
ok  	sync/atomic	0.409s
ok  	syscall	0.468s
ok  	testing	1.321s
ok  	testing/quick	3.272s
ok  	text/scanner	0.063s
ok  	text/tabwriter	0.121s
ok  	text/template	6.269s
ok  	text/template/parse	0.270s
ok  	time	5.599s
ok  	unicode	0.109s
ok  	unicode/utf16	0.060s
ok  	unicode/utf8	0.039s
ok  	vendor/golang_org/x/crypto/chacha20poly1305	1.369s
ok  	vendor/golang_org/x/crypto/cryptobyte	0.041s
ok  	vendor/golang_org/x/crypto/curve25519	2.048s
ok  	vendor/golang_org/x/crypto/internal/chacha20	0.827s
ok  	vendor/golang_org/x/crypto/poly1305	0.124s
ok  	vendor/golang_org/x/net/dns/dnsmessage	0.576s
ok  	vendor/golang_org/x/net/http/httpguts	0.031s
ok  	vendor/golang_org/x/net/http/httpproxy	0.034s
ok  	vendor/golang_org/x/net/http2/hpack	0.054s
ok  	vendor/golang_org/x/net/idna	0.027s
ok  	vendor/golang_org/x/net/nettest	2.825s
ok  	vendor/golang_org/x/text/transform	0.044s
ok  	vendor/golang_org/x/text/unicode/norm	0.058s
ok  	cmd/addr2line	20.091s
ok  	cmd/api	0.128s
ok  	cmd/asm/internal/asm	12.509s
ok  	cmd/asm/internal/lex	0.038s
ok  	cmd/compile	0.440s
ok  	cmd/compile/internal/gc	223.359s
ok  	cmd/compile/internal/ssa	5.968s
ok  	cmd/compile/internal/syntax	0.185s
ok  	cmd/compile/internal/test	0.056s [no tests to run]
ok  	cmd/compile/internal/types	0.059s
ok  	cmd/cover	66.919s
ok  	cmd/doc	0.932s
ok  	cmd/fix	81.117s
ok  	cmd/go	77.747s
ok  	cmd/go/internal/cache	39.116s
ok  	cmd/go/internal/dirhash	0.081s
ok  	cmd/go/internal/generate	0.240s
ok  	cmd/go/internal/get	0.267s
ok  	cmd/go/internal/imports	0.125s
ok  	cmd/go/internal/load	0.066s
ok  	cmd/go/internal/modconv	0.341s
ok  	cmd/go/internal/modfetch	0.167s
ok  	cmd/go/internal/modfetch/codehost	0.071s
ok  	cmd/go/internal/modfile	0.117s
ok  	cmd/go/internal/modload	0.161s
ok  	cmd/go/internal/module	0.035s
ok  	cmd/go/internal/mvs	0.074s
ok  	cmd/go/internal/par	0.225s
ok  	cmd/go/internal/search	0.047s
ok  	cmd/go/internal/semver	0.076s
ok  	cmd/go/internal/txtar	0.025s
ok  	cmd/go/internal/web2	0.079s
ok  	cmd/go/internal/work	0.145s
ok  	cmd/gofmt	0.659s
ok  	cmd/internal/buildid	6.528s
ok  	cmd/internal/dwarf	0.074s
ok  	cmd/internal/edit	0.023s
ok  	cmd/internal/goobj	7.811s
ok  	cmd/internal/obj	0.034s
ok  	cmd/internal/obj/arm64	0.274s
ok  	cmd/internal/obj/x86	32.780s
ok  	cmd/internal/objabi	0.023s
ok  	cmd/internal/src	0.026s
ok  	cmd/internal/test2json	2.687s
ok  	cmd/link	32.257s
ok  	cmd/link/internal/ld	93.950s
ok  	cmd/link/internal/sym	0.037s
ok  	cmd/nm	46.690s
ok  	cmd/objdump	31.699s
ok  	cmd/pack	29.260s
ok  	cmd/trace	0.268s
ok  	cmd/vendor/github.com/google/pprof/internal/binutils	0.171s
ok  	cmd/vendor/github.com/google/pprof/internal/driver	6.295s
ok  	cmd/vendor/github.com/google/pprof/internal/elfexec	0.039s
ok  	cmd/vendor/github.com/google/pprof/internal/graph	0.065s
ok  	cmd/vendor/github.com/google/pprof/internal/measurement	0.055s
ok  	cmd/vendor/github.com/google/pprof/internal/report	0.831s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolizer	0.139s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolz	0.040s
ok  	cmd/vendor/github.com/google/pprof/profile	0.990s
ok  	cmd/vendor/github.com/ianlancetaylor/demangle	0.406s
ok  	cmd/vendor/golang.org/x/arch/arm/armasm	0.125s
ok  	cmd/vendor/golang.org/x/arch/arm64/arm64asm	1.389s
ok  	cmd/vendor/golang.org/x/arch/ppc64/ppc64asm	0.606s
ok  	cmd/vendor/golang.org/x/arch/x86/x86asm	2.073s
ok  	cmd/vendor/golang.org/x/crypto/ssh/terminal	0.080s
ok  	cmd/vendor/golang.org/x/sys/unix	0.431s
ok  	cmd/vet	26.462s
ok  	cmd/vet/internal/cfg	0.047s
2018/09/04 10:46:36 Failed: exit status 1
@bradfitz

This comment has been minimized.

Member

bradfitz commented Sep 4, 2018

@benshi001,

go1.10.4 as bootstrap

Per the comments above, this is about using Go 1.4 as the bootstrap.

@Akito13

This comment has been minimized.

Akito13 commented Nov 6, 2018

Same issue here.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Nov 6, 2018

@Akito13, can you confirm the details of your environment so we know what "same issue" means?

@Akito13

This comment has been minimized.

Akito13 commented Nov 6, 2018

@Akito13, can you confirm the details of your environment so we know what "same issue" means?

"Same issue" means "same issue". Same versions, same process, same hardware, everything the same. My case is a twin of this.

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 20, 2018

I also tried to compile Go on Raspberry Pi running Raspbian. I, however, am not using an SD card. I've moved my files to a HDD and increased my swap file to 2048.

Here are the commands I used to obtain, download, and install Go.

mkdir golang
cd golang/
git clone https://go.googlesource.com/go
cd go
mutt
git checkout go1.11.2
src
./all.bash

My output would look like the output listed on Sept 3 by @benshi001.

@Akito13

This comment has been minimized.

Akito13 commented Nov 20, 2018

I solved it by changing to my computer and compiling the go1.4 bootstrapper, then compiling the newest go1.11.2 and then compiling go1.11.2 on my target Raspberry Pi with the go1.11.2 I compiled earlier on the machine. Now go works flawlessly.

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 20, 2018

@Akito13

This comment has been minimized.

Akito13 commented Nov 20, 2018

Ok, so just to be sure I understand what you are saying. You basically used a non-RPi computer to cross-compile Go for use on the RPi. That’s a good idea. I’ll give it a try.

________________________________ From: Akito13 notifications@github.com Sent: Tuesday, November 20, 2018 6:53 AM To: golang/go Cc: Jim; Comment Subject: Re: [golang/go] cmd/compile: "internal compiler error: weird decoding" on Raspberry Pi with Go 1.11 (#27228) I solved it by changing to my computer and compiling the go1.4 bootstrapper, then compiling the newest go1.11.2 and then compiling go1.11.2 on my target Raspberry Pi with the go1.11.2 I compiled earlier on the machine. Now go works flawlessly. — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#27228 (comment)>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APLcyF3THDluIboGpVdagz2NN4zp9VK7ks5uw_tWgaJpZM4WMmyp.

Yes. I followed the official Go instructions on its website, except I compiled go1.11.2 with go1.4 on my computer and then put the compiled go1.11.2 on my Raspi so I can compile the additional go1.11.2 for my Raspi. It's important to note that I used the go1.11.2 from the computer only as the bootstrapper for the actual go1.11.2 on my Raspi. So you have to set the DEBOOTSTRAP PATH correctly to the go1.11.2 from the computer on your Raspi. Hope it will work for you.

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 22, 2018

@Akito13 When you were compiling Go on your computer, did you get a lot of errors during the testing phase similar to:


fork/exec C:\Users\pavul\AppData\Local\Temp\go-build234995090\b802\syntax.test: %1 is not a valid Win32 application.
FAIL    regexp/syntax   1.489s
@Akito13

This comment has been minimized.

Akito13 commented Nov 22, 2018

@Akito13 When you were compiling Go on your computer, did you get a lot of errors during the testing phase similar to:


fork/exec C:\Users\pavul\AppData\Local\Temp\go-build234995090\b802\syntax.test: %1 is not a valid Win32 application.
FAIL    regexp/syntax   1.489s

I compiled it within the Linux Subsystem for Windows. I would never let Windows touch my sources.

@josharian

This comment has been minimized.

Contributor

josharian commented Nov 22, 2018

It sounds like there might be a bug in the Go 1.4 compiler that causes it to miscompile the Go 1.11 source code on arm.

Those of you who can reproduce this reliably, would you mind trying building Go 1.10 or Go 1.9 from source, using Go 1.4 as your bootstrap compiler? Thanks!

@Akito13

This comment has been minimized.

Akito13 commented Nov 22, 2018

@pavulon18 I used these intructions to make it work. Reading this document again, I remember now that I cross-compiled it the way it shows there. I did not mention that, because by the time I answered you the first time, I did not remember what I actually did when I made it work after all.
So once you get the bootstrap folder, you copy it over to your Raspi and use it as a bootstrapper for the actual go1.11.2 you want to have on your Raspi. Sorry for the misunderstanding.

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 22, 2018

@Akito13
Thank you for the link. If my current attempt at cross-compile doesn't work, I'll follow these instructions.

@Akito13

This comment has been minimized.

Akito13 commented Nov 22, 2018

@Akito13
Thank you for the link. If my current attempt at cross-compile doesn't work, I'll follow these instructions.

Did it GO well?

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 23, 2018

@Akito13 no. I got a segmentation fault.

ok      runtime/internal/atomic 0.806s
ok      runtime/internal/sys    0.039s
signal: segmentation fault
FAIL    runtime/pprof   2.261s
ok      runtime/pprof/internal/profile  0.110s
ok      runtime/trace   22.170s
ok      sort    0.446s
root@gcems:/home/jim/golang/go/src # /home/jim/golang/go-linux-arm-bootstrap/bin/go env
GOARCH="arm"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/home/jim/golang/go-linux-arm-bootstrap"
GOTMPDIR=""
GOTOOLDIR="/home/jim/golang/go-linux-arm-bootstrap/pkg/tool/linux_arm"
GCCGO="/usr/bin/gccgo"
GOARM="7"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build777983222=/tmp/go-build -gno-record-gcc-switches"
@Akito13

This comment has been minimized.

Akito13 commented Nov 23, 2018

@pavulon18 So I freshly compiled the bootstrapper for the Raspi again. I uploaded it here.
Once you downloaded it to your Raspberry Pi, do the following:

  1. We assume, you unpacked the above downloaded file into ~/src/, creating the folder ./go-linux-arm-bootstrap within ~/src/.

  2. export GOROOT_BOOTSTRAP=/home/insert-your-username/src/go-linux-arm-bootstrap

  3. You are in the ~/src folder now. Now you get the newest go (using the master branch):

    1. git clone https://go.googlesource.com/go
    2. cd go
    3. (Optional) You may also switch to go1.11.2 instead of using the master branch, if you want to be extra safe, like that: git checkout go1.11.2
  4. You compile the actual Go that Raspberry Pi will use now:

    1. cd src
    2. ./make.bash
    3. This will take some time, so be patient.
  5. (Optional) Test your Go installation:

    1. cd .. ; cd bin; nano hello.go
    2. You paste in the following:
package main

import "fmt"

func main() {

        fmt.Printf("It woooooooooorks!\n")

}
  1. Now do ./go run hello.go and output should be It woooooooooorks!.

  2. Set your environment ready to GO:

    1. export PATH="$PATH:/home/insert-your-username/src/go/bin"
    2. export GOPATH=$HOME/go
  3. Check if PATH is set correctly: go version

@Akito13

This comment has been minimized.

Akito13 commented Nov 23, 2018

I made a Github Repository for the readily made bootstrapper, so everyone in need can take advantage of this workaround.

@pavulon18

This comment has been minimized.

pavulon18 commented Nov 23, 2018

Thank you. That seems to have worked.

@Akito13

This comment has been minimized.

Akito13 commented Nov 23, 2018

Thank you. That seems to have worked.

Well, I'm glad. Hope it will keep working.

@leeyinghui1107

This comment has been minimized.

leeyinghui1107 commented Dec 1, 2018

Thank you. That seems to have worked.

Well, I'm glad. Hope it will keep working.

It worked perfect, thank you!

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