From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv6] package/golang: new package
Date: Wed, 21 Oct 2015 23:07:01 +0200 [thread overview]
Message-ID: <20151021230701.4701e646@free-electrons.com> (raw)
In-Reply-To: <1438277053-10053-1-git-send-email-yann.morin.1998@free.fr>
Yann, Christian,
On Thu, 30 Jul 2015 19:24:13 +0200, Yann E. MORIN wrote:
> We're adding a host package to get the golang cross-compiler, and a
> target package to get the golang interpreter on the target.
As discussed on IRC, I tested the host package, and it is not a
cross-compiler, but a regular compiler, which makes it pretty useless:
$ ./output/host/usr/bin/go build toto.go
$ file toto
toto: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
> diff --git a/package/golang/Config.in b/package/golang/Config.in
> new file mode 100644
> index 0000000..8dbd75a
> --- /dev/null
> +++ b/package/golang/Config.in
> @@ -0,0 +1,22 @@
> +comment "golang needs a toolchain w/ threads, dynamic library"
> + depends on BR2_PACKAGE_GOLANG_ARCH_SUPPORTS
> + depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
> +
> +# golang only supports x86, x86_64 and ARM (LE) targets.
> +# For ARM, armv5 or above is required.
> +config BR2_PACKAGE_GOLANG_ARCH_SUPPORTS
> + bool
> + default y
> + depends on BR2_USE_MMU
> + depends on BR2_i386 || BR2_x86_64 || BR2_arm
> + depends on !BR2_ARM_CPU_ARMV4
> +
> +config BR2_PACKAGE_GOLANG
> + bool "golang"
> + depends on BR2_PACKAGE_GOLANG_ARCH_SUPPORTS
> + depends on !BR2_STATIC_LIBS
> + depends on BR2_TOOLCHAIN_HAS_THREADS
> + help
> + Go compiler and cli tool.
I think this is fairly confusing. We should instead say:
Go interpreter.
and indicate that if people want to run Go applications that have been
built on their host machine, then they don't need the golang target
package.
> diff --git a/package/golang/golang.mk b/package/golang/golang.mk
> new file mode 100644
> index 0000000..58d5847
> --- /dev/null
> +++ b/package/golang/golang.mk
> @@ -0,0 +1,84 @@
> +################################################################################
> +#
> +# GOLANG
should be lower case, as already noted by Jerzy.
> +# We must install both the src/ and include/ subdirs because they
> +# contain the go "runtime".
> +define GOLANG_INSTALL_TARGET_CMDS
> + $(INSTALL) -D -m 0755 $(@D)/bin/linux_$(GOLANG_ARCH)/go $(TARGET_DIR)/usr/bin/go
> + $(INSTALL) -D -m 0755 $(@D)/bin/linux_$(GOLANG_ARCH)/gofmt $(TARGET_DIR)/usr/bin/gofmt
Why do we install gofmt on the target? Buildroot doesn't install tools
to do development on the target, so installing gofmt seems weird.
> + mkdir -p $(TARGET_DIR)/usr/lib/go/
> + cp -a $(@D)/src $(TARGET_DIR)/usr/lib/go/
> + cp -a $(@D)/include $(TARGET_DIR)/usr/lib/go/
> + cp -a $(@D)/pkg $(TARGET_DIR)/usr/lib/go/
If I understand correctly, all of this "runtime" is actually only
needed if you use "go" as an interpreter on the target. If you use "go"
on the host as a cross-compiler to build your application, you don't
need any of this "runtime". This stuff is actually quite huge (around
70 MB!).
Note that we more commonly use "cp -dprf" in Buildroot rather than "cp
-a", but I guess it's not a super-strict rule.
I've marked the patch as Changes Requested in patchwork.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-10-21 21:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 17:24 [Buildroot] [PATCHv6] package/golang: new package Yann E. MORIN
2015-07-31 6:33 ` Jerzy Grzegorek
2015-10-21 21:07 ` Thomas Petazzoni [this message]
[not found] ` <CA+h8R2p5xgF7rJJW5z0AzB7b359F=S9yWrXpiTmCVK-D0Sk8pw@mail.gmail.com>
[not found] ` <20151021232135.1997edb6@free-electrons.com>
2015-10-21 21:37 ` Christian Stewart
2015-10-21 21:37 ` [Buildroot] Fwd: " Christian Stewart
2015-11-04 15:39 ` [Buildroot] " Christian Stewart
2015-11-04 17:21 ` Yann E. MORIN
2015-11-04 17:31 ` Thomas Petazzoni
2015-11-04 21:21 ` Christian Stewart
2015-11-05 21:15 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151021230701.4701e646@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.