ARM compatibility
Using a Scaleway C1 server, this would be useful.
So far the workaround for apt seems to be:
apt-get install -y golang git-core mercurial bzr
go get gopkg.in/niemeyer/godeb.v1/cmd/godeb
# or
go get github.com/niemeyer/godeb
However the first version returns:
error: no downloads available at https://code.google.com/p/go/downloads/list?can=1&q=linux
and the second one returns:
root@andrei-arm:~# godeb list
panic: compiling xml path "//a/@href[contains(., 'storage.googleapis.com')]":19: unsupported expression: contains()
goroutine 4 [running]:
runtime.panic(0x278410, 0x10a32fe0)
/usr/lib/go/src/pkg/runtime/panic.c:266 +0x134
launchpad.net/xmlpath.MustCompile(0x2f3f08, 0x30, 0x1087d000)
/root/go/src/launchpad.net/xmlpath/path.go:360 +0x78
main.tarballsFrom(0x2f07e8, 0x2b, 0x2f3f08, 0x30, 0x0, ...)
/root/go/src/github.com/niemeyer/godeb/main.go:231 +0x35c
main.func·001()
/root/go/src/github.com/niemeyer/godeb/main.go:193 +0x4c
created by main.tarballs
/root/go/src/github.com/niemeyer/godeb/main.go:195 +0x168
goroutine 1 [chan receive]:
main.tarballs(0x1081bda0, 0x2c3e0a, 0x3, 0x1, 0x7)
/root/go/src/github.com/niemeyer/godeb/main.go:201 +0x1d8
main.listCommand(0xbefa18df, 0x4)
/root/go/src/github.com/niemeyer/godeb/main.go:72 +0x24
main.run(0x18b0c, 0x27d658)
/root/go/src/github.com/niemeyer/godeb/main.go:66 +0x91c
main.main()
/root/go/src/github.com/niemeyer/godeb/main.go:30 +0x24
goroutine 3 [select]:
net/http.(*persistConn).roundTrip(0x1082f230, 0x108005a8, 0x1082f230, 0x0, 0x0)
/usr/lib/go/src/pkg/net/http/transport.go:879 +0x6c0
net/http.(*Transport).RoundTrip(0x10840180, 0x1082ea10, 0xf, 0x0, 0x0)
/usr/lib/go/src/pkg/net/http/transport.go:187 +0x300
net/http.send(0x1082ea10, 0x4006f9c8, 0x10840180, 0x0, 0x0, ...)
/usr/lib/go/src/pkg/net/http/client.go:168 +0x328
net/http.(*Client).send(0x53e1d8, 0x1082ea10, 0x39, 0x1f93c, 0x4)
/usr/lib/go/src/pkg/net/http/client.go:100 +0x114
net/http.(*Client).doFollowingRedirects(0x53e1d8, 0x1082ea10, 0x30f50c, 0x0, 0x0, ...)
/usr/lib/go/src/pkg/net/http/client.go:294 +0x588
net/http.(*Client).Get(0x53e1d8, 0x2fa9d8, 0x39, 0x0, 0x0, ...)
/usr/lib/go/src/pkg/net/http/client.go:248 +0xb0
net/http.Get(0x2fa9d8, 0x39, 0x0, 0x0, 0x0)
/usr/lib/go/src/pkg/net/http/client.go:225 +0x50
main.tarballsFrom(0x2fa9d8, 0x39, 0x2ec808, 0x2b, 0x0, ...)
/root/go/src/github.com/niemeyer/godeb/main.go:216 +0x60
main.func·001()
/root/go/src/github.com/niemeyer/godeb/main.go:193 +0x4c
created by main.tarballs
/root/go/src/github.com/niemeyer/godeb/main.go:195 +0x168
goroutine 10 [IO wait]:
net.runtime_pollWait(0x400709e8, 0x72, 0x0)
/usr/lib/go/src/pkg/runtime/netpoll.goc:116 +0x6c
net.(*pollDesc).Wait(0x10864db8, 0x72, 0x4006f8a8, 0xb)
/usr/lib/go/src/pkg/net/fd_poll_runtime.go:81 +0x38
net.(*pollDesc).WaitRead(0x10864db8, 0xb, 0x4006f8a8)
/usr/lib/go/src/pkg/net/fd_poll_runtime.go:86 +0x34
net.(*netFD).Read(0x10864d80, 0x10848c00, 0x400, 0x400, 0x0, ...)
/usr/lib/go/src/pkg/net/fd_unix.go:204 +0x2f0
net.(*conn).Read(0x10800638, 0x10848c00, 0x400, 0x400, 0x0, ...)
/usr/lib/go/src/pkg/net/net.go:122 +0xbc
crypto/tls.(*block).readFromUntil(0x10867360, 0x40070ac0, 0x10800638, 0x5, 0x10800638, ...)
/usr/lib/go/src/pkg/crypto/tls/conn.go:459 +0xcc
crypto/tls.(*Conn).readRecord(0x1085e600, 0x17, 0x0, 0x1ca90)
/usr/lib/go/src/pkg/crypto/tls/conn.go:539 +0x10c
crypto/tls.(*Conn).Read(0x1085e600, 0x10a0c000, 0x1000, 0x1000, 0x0, ...)
/usr/lib/go/src/pkg/crypto/tls/conn.go:897 +0x15c
bufio.(*Reader).fill(0x10a06420)
/usr/lib/go/src/pkg/bufio/bufio.go:91 +0x16c
bufio.(*Reader).Peek(0x10a06420, 0x1, 0x0, 0x1d750, 0x53e35c, ...)
/usr/lib/go/src/pkg/bufio/bufio.go:119 +0xc0
net/http.(*persistConn).readLoop(0x1082f230)
/usr/lib/go/src/pkg/net/http/transport.go:687 +0xc4
created by net/http.(*Transport).dialConn
/usr/lib/go/src/pkg/net/http/transport.go:528 +0x5b0
goroutine 7 [syscall]:
runtime.goexit()
/usr/lib/go/src/pkg/runtime/proc.c:1394
goroutine 8 [IO wait]:
net.runtime_pollWait(0x4007097c, 0x72, 0x0)
/usr/lib/go/src/pkg/runtime/netpoll.goc:116 +0x6c
net.(*pollDesc).Wait(0x10864df8, 0x72, 0x4006f8a8, 0xb)
/usr/lib/go/src/pkg/net/fd_poll_runtime.go:81 +0x38
net.(*pollDesc).WaitRead(0x10864df8, 0xb, 0x4006f8a8)
/usr/lib/go/src/pkg/net/fd_poll_runtime.go:86 +0x34
net.(*netFD).Read(0x10864dc0, 0x10a0e000, 0x800, 0x800, 0x0, ...)
/usr/lib/go/src/pkg/net/fd_unix.go:204 +0x2f0
net.(*conn).Read(0x10800680, 0x10a0e000, 0x800, 0x800, 0x0, ...)
/usr/lib/go/src/pkg/net/net.go:122 +0xbc
crypto/tls.(*block).readFromUntil(0x108674a0, 0x40070ac0, 0x10800680, 0x5, 0x10800680, ...)
/usr/lib/go/src/pkg/crypto/tls/conn.go:459 +0xcc
crypto/tls.(*Conn).readRecord(0x1085e780, 0x17, 0x0, 0x0)
/usr/lib/go/src/pkg/crypto/tls/conn.go:539 +0x10c
crypto/tls.(*Conn).Read(0x1085e780, 0x10a07000, 0x1000, 0x1000, 0x0, ...)
/usr/lib/go/src/pkg/crypto/tls/conn.go:897 +0x15c
bufio.(*Reader).fill(0x10a06120)
/usr/lib/go/src/pkg/bufio/bufio.go:91 +0x16c
bufio.(*Reader).Peek(0x10a06120, 0x1, 0x0, 0x0, 0x0, ...)
/usr/lib/go/src/pkg/bufio/bufio.go:119 +0xc0
net/http.(*persistConn).readLoop(0x1082f280)
/usr/lib/go/src/pkg/net/http/transport.go:687 +0xc4
created by net/http.(*Transport).dialConn
/usr/lib/go/src/pkg/net/http/transport.go:528 +0x5b0
goroutine 9 [select]:
net/http.(*persistConn).writeLoop(0x1082f280)
/usr/lib/go/src/pkg/net/http/transport.go:791 +0x22c
created by net/http.(*Transport).dialConn
/usr/lib/go/src/pkg/net/http/transport.go:529 +0x5d8
goroutine 11 [select]:
net/http.(*persistConn).writeLoop(0x1082f230)
/usr/lib/go/src/pkg/net/http/transport.go:791 +0x22c
created by net/http.(*Transport).dialConn
/usr/lib/go/src/pkg/net/http/transport.go:529 +0x5d8
root@andrei-arm:~# uname -a
Linux andrei-arm 3.2.34-30 #17 SMP Mon Apr 13 15:53:45 UTC 2015 armv7l armv7l armv7l GNU/Linux
root@andrei-arm:~# go version
go version go1.2.1 linux/arm
Sorry for spamming. I found this useful resource: http://dave.cheney.net/unofficial-arm-tarballs
I don't think many changes are needed to make this happen. My Raspberry Pi 4 (armv7l) reports build.Default.GOARCH as "arm".
$ cat arch.go
package main
import (
"fmt"
"go/build"
)
func main() {
fmt.Println("arch", build.Default.GOARCH)
}
$ go run arch.go
arch arm
$ uname -m
armv7l
I used this info to change main.go and deb.go and was able to have godeb generate and install a valid *.deb file for Raspbian on the Pi 4. In deb.go I updated the debArch function:
func debArch() string {
arch := build.Default.GOARCH
if arch == "386" {
return "i386"
}
if arch == "arm" {
return "armhf"
}
return arch
}
And also updated main.go's tarball function:
var tbs []*Tarball
for _, v := range versions {
for _, f := range v.Files {
if f.Os == build.Default.GOOS && (f.Arch == build.Default.GOARCH ||
(build.Default.GOARCH == "arm" && f.Arch == "armv6l")) {
t := Tarball{
Version: strings.TrimPrefix(f.Version, "go"),
URL: downloadBaseURL + f.Filename}
tbs = append(tbs, &t)
break
}
}
}
It's probably not the best solution, but it works for me. Thoughts?