From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/pkg-golang.mk: add osusergo and netgo tags in static builds
Date: Sun, 16 Apr 2023 21:59:05 +0200 [thread overview]
Message-ID: <20230416195905.GG2819@scaer> (raw)
In-Reply-To: <20220918122239.189147-1-arnout@mind.be>
Arnout, All,
On 2022-09-18 14:22 +0200, Arnout Vandecappelle spake thusly:
> CGO (the Go language C bindings) normally links dynamically with the C
> libraries. It seems that passing -extldflags=-static is not sufficient
> to make sure they link statically. As a result, a build using CGO will
> fail with
>
> runtime.gcdata: missing Go type information for global symbol .dynsym: size 72
>
> There are two modules in the standard Go library that can use CGO:
> os/user and net. Both of these have pure Go versions, however, which can
> be selected with the osusergo and netgo tags. Since these two are
> standard library modules that get used in almost all Go programs, pass
> those flags in the common infrastructure.
>
> It's not entirely clear if this is always the case or only depending on
> the specific way CGO is used. In the former case, we could instead
> disable CGO globally if static libs are enabled. However, it turns out
> that this doesn't solve the problem completely anyway (delve still fails
> to link, with different errors). Also, it is possible that other cgo
> modules do still work. Therefore, just stick to adding the osusergo and
> netgo tags.
>
> Fixes:
> - crucible:
> http://autobuild.buildroot.net/results/c2f/c2f29f55b461899e8e15c0494578304e6f74bf51/
> - containerd:
> http://autobuild.buildroot.net/results/699/69910fc6b9f474a7eb0ca7ffa27ac5512cc1bb37/
> - delve:
> http://autobuild.buildroot.net/results/552/55225d5da17e85271943f7adce6f07d014d9717d/
> - probably others...
>
> Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Applied to master, after adding the link to the docuemntation you
pointed to in your reply (without any typo, I hope), thanks.
Regards,
Yann E. MORIN.
> ---
> package/pkg-golang.mk | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
> index 0b3dc3d32f..a4fc353e78 100644
> --- a/package/pkg-golang.mk
> +++ b/package/pkg-golang.mk
> @@ -100,6 +100,7 @@ ifeq ($(4),target)
>
> ifeq ($(BR2_STATIC_LIBS),y)
> $(2)_LDFLAGS += -extldflags '-static'
> +$(2)_TAGS += osusergo netgo
> endif
>
> # Build package for target
> --
> 2.37.3
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-04-16 19:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 12:22 [Buildroot] [PATCH] package/pkg-golang.mk: add osusergo and netgo tags in static builds Arnout Vandecappelle
2022-09-18 12:23 ` Arnout Vandecappelle
2022-11-16 12:57 ` Fabio Estevam
2023-04-16 19:59 ` Yann E. MORIN [this message]
2023-04-23 10:32 ` Peter Korsgaard
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=20230416195905.GG2819@scaer \
--to=yann.morin.1998@free.fr \
--cc=arnout@mind.be \
--cc=buildroot@buildroot.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox