[Buildroot] [PATCH RFC] package/go: disable cgo support with static libs

Yann E. MORIN yann.morin.1998 at free.fr
Mon Nov 21 21:17:07 UTC 2022


Anisse, All,

In addition to the feedback from Baruch, see below...

On 2022-11-20 19:19 +0100, Anisse Astier spake thusly:
> The go stdlib "plugin" package relies on dlfcn.h which isn't available
> when we have BR2_STATIC_LIBS=y.
> 
> This should fix this build error from autobuilders:
> 
> /buildroot/i686-hostgo-fail/build/host-go-1.19.3/src/plugin/plugin_dlopen.go:11:10: fatal error: dlfcn.h: No such file or directory
>    11 | #include <dlfcn.h>
> 
> The more longterm approach would be to ask upstream for a build tag to
> disable the plugin package, akin to the osusergo or netgo tags:
> 
> https://github.com/golang/go/issues/23265
> 
> While it would be quite simple, I don't think a buildroot patch for this
> without upstream support would be ideal.

No first-person sentences in commit log. Instead:

    While it would be quite simple, we do not want to carry such a
    feature patch in Buildroot, especially since none has yet been
    submitted upstream.

But as you state that it should be rlatively easy, maybe you can push
such a patch upstream? Then, depending on upstream's feedback, we could
backport it...

Regards,
Yann E. MORIN.

> ---
>  package/go/go.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/go/go.mk b/package/go/go.mk
> index fd4caa2e5a..1c3cfa94d4 100644
> --- a/package/go/go.mk
> +++ b/package/go/go.mk
> @@ -87,7 +87,7 @@ HOST_GO_TARGET_ENV = \
>  # set, build in cgo support for any go programs that may need it.  Note that
>  # any target package needing cgo support must include
>  # 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file.
> -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS)$(BR2_STATIC_LIBS),yn)
>  HOST_GO_CGO_ENABLED = 1
>  else
>  HOST_GO_CGO_ENABLED = 0
> -- 
> 2.38.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at 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.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list