How to build for armhf?

Hello,

Can I get some help to build the syncthing deb for armhf?

I’m in ubuntu xenial amd64, and this is what happens when I try:

elopio@remote-devel:~/workspace/go/src/github.com/syncthing/syncthing> go run build.go -goarch arm deb
runtime/internal/sys
go install runtime/internal/sys: mkdir /usr/lib/go-1.6/pkg/linux_arm: permission denied
exit status 1
exit status 1

> go env                         
GOARCH="amd64"
GOBIN="/home/elopio/workspace/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/elopio/workspace/go/"
GORACE=""
GOROOT="/usr/lib/go-1.6"
GOTOOLDIR="/usr/lib/go-1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

I can build the amd64 deb without issues.

The go compiler needs to rebuild the standard library for arm, so you need to have write access to the compiler installation.

Did you even read the error message?

That’s rude, even for you. :wink:

No, it’s a genuine question.

Ok, I guess it can be confusing as to why it wants to write there, in which case yeah, I do sound like an asshole, but the error message is somewhat self explanatory, don’t you agree?

Yes, you were mean. Of course I read it, I just don’t want to give permissions to write in /usr to a build script.

You’ll need to do that though, or have the build user own the Go installation (which is what we do on the build servers).

Using the official tarballs that extract directly into /usr/local/go, instead of some outdated Go version managed by the system package manager, helps.

Thanks for the pointers. I ran my tests in a lxc, and things look fine.