mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Go in ptxdist
@ 2016-10-04 15:23 Clemens Gruber
  2016-10-05 13:13 ` Michael Olbrich
  0 siblings, 1 reply; 12+ messages in thread
From: Clemens Gruber @ 2016-10-04 15:23 UTC (permalink / raw)
  To: ptxdist

Hi,

I'd like to start a discussion about implementing support for Go
language projects in ptxdist. https://golang.org

The nice thing about the recent Go versions is that cross compilation is
possible without recompiling Go for the target architecture.
You can use the Go version from your host and cross compile to the
supported target architectures and operating system.
Go binaries are statically compiled, so we would only need Go on the
host system.

To cross-compile an ARMv7 binary, you just call:
env GOOS=linux GOARCH=arm GOARM=7 go build helloworld.go
Tested with Go 1.7.1 on ArchLinux and cross-compiled binary is running
successfully on an i.MX6Q.
If you are wondering about my use case:
I am implementing a Webapp backend with Revel (github.com/revel/revel)
for the admin interface to our embedded product and Go is a fine
language for writing server software.

--

What are your thoughts about this?

--

Maybe:
Having a new FOO_CONF_TOOL value "go" similar to "python3" and adding
additional case statements to scripts/lib/ptxd_make_world_*.sh and
building the Go files there, either via go build or using go install.

We probably need a static mapping from supported toolchain ABIs to
GOARCH (and GOARM) values:
aarch64-v8a-linux-gnu       -> GOARCH=arm64
arm-1136jfs-linux-gnueabi   -> GOARCH=arm GOARM=5
arm-1136jfs-linux-gnueabihf -> GOARCH=arm GOARM=6
arm-cortexa8-linux-gnueabi  -> GOARCH=arm GOARM=5
arm-cortexa8-linux-gnueabihf-> GOARCH=arm GOARM=7
arm-v5te-linux-gnueabi      -> GOARCH=arm GOARM=5
arm-v7a-linux-gnueabi       -> GOARCH=arm GOARM=5
arm-v7a-linux-gnueabihf     -> GOARCH=arm GOARM=7
i586-unknown-linux-gnu      -> GOARCH=386
i686-atom-linux-gnu         -> GOARCH=386
x86_64-unknown-linux-gnu    -> GOARCH=amd64

Go supports >=ARMv6 builds with hardfloat only, so I'd fall back to
building ARMv5 binaries for ARMv6/7 softfloat configurations.

The mininum size of the generated binaries is still rather large, but
this will improve in Go 1.8: https://blog.golang.org/go1.7-binary-size
(At the moment, my hello world example is 927KB if stripped, as it
includes the statically linked runtime)
I probably would not use it for small little tools running only for
short time periods, but for long-running server software, it's fine.

Regards,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-10-12  0:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 15:23 [ptxdist] Go in ptxdist Clemens Gruber
2016-10-05 13:13 ` Michael Olbrich
2016-10-05 15:55   ` Clemens Gruber
2016-10-05 16:31     ` Michael Olbrich
2016-10-05 20:42       ` Clemens Gruber
2016-10-06  9:17         ` Michael Olbrich
2016-10-07 16:47           ` Clemens Gruber
2016-10-07 18:37             ` Uwe Kleine-König
2016-10-11 16:18               ` Clemens Gruber
2016-10-12  0:07                 ` Clemens Gruber
2016-10-06  6:33     ` Uwe Kleine-König
2016-10-06 10:04       ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox