All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs
@ 2022-11-20 18:19 Anisse Astier
  2022-11-21  6:27 ` Baruch Siach via buildroot
  2022-11-21 21:17 ` Yann E. MORIN
  0 siblings, 2 replies; 5+ messages in thread
From: Anisse Astier @ 2022-11-20 18:19 UTC (permalink / raw)
  To: buildroot; +Cc: Anisse Astier

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.
---
 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@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs
  2022-11-20 18:19 [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs Anisse Astier
@ 2022-11-21  6:27 ` Baruch Siach via buildroot
  2022-11-21 22:42   ` Anisse Astier
  2022-11-21 21:17 ` Yann E. MORIN
  1 sibling, 1 reply; 5+ messages in thread
From: Baruch Siach via buildroot @ 2022-11-21  6:27 UTC (permalink / raw)
  To: Anisse Astier; +Cc: buildroot

Hi Anisse,

On Sun, Nov 20 2022, Anisse Astier wrote:
> 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.

Your sign-off here is missing.

> ---
>  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)

This will not work as you intend. $(BR2_STATIC_LIBS) resolve to an empty
string when BR2_STATIC_LIBS is not set. You want something like:

ifeq ($(BR2_TOOLCHAIN_HAS_THREADS):$(BR2_STATIC_LIBS),y:)

baruch

>  HOST_GO_CGO_ENABLED = 1
>  else
>  HOST_GO_CGO_ENABLED = 0


-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs
  2022-11-20 18:19 [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs Anisse Astier
  2022-11-21  6:27 ` Baruch Siach via buildroot
@ 2022-11-21 21:17 ` Yann E. MORIN
  2022-11-21 22:43   ` Anisse Astier
  1 sibling, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2022-11-21 21:17 UTC (permalink / raw)
  To: Anisse Astier; +Cc: buildroot

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@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

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

* Re: [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs
  2022-11-21  6:27 ` Baruch Siach via buildroot
@ 2022-11-21 22:42   ` Anisse Astier
  0 siblings, 0 replies; 5+ messages in thread
From: Anisse Astier @ 2022-11-21 22:42 UTC (permalink / raw)
  To: Baruch Siach; +Cc: buildroot

Hi Baruch,

Lun 21 nov 2022, à 07:27, Baruch Siach via buildroot a écrit :
> Hi Anisse,
> 
> On Sun, Nov 20 2022, Anisse Astier wrote:
> > 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.
> 
> Your sign-off here is missing.
> 
> > ---
> >  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)
> 
> This will not work as you intend. $(BR2_STATIC_LIBS) resolve to an empty
> string when BR2_STATIC_LIBS is not set. You want something like:
> 
> ifeq ($(BR2_TOOLCHAIN_HAS_THREADS):$(BR2_STATIC_LIBS),y:)
> 
> baruch
> 

Thanks for your review, this will be in v2.

Regards,

Anisse
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs
  2022-11-21 21:17 ` Yann E. MORIN
@ 2022-11-21 22:43   ` Anisse Astier
  0 siblings, 0 replies; 5+ messages in thread
From: Anisse Astier @ 2022-11-21 22:43 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

Hi Yann,

Lun 21 nov 2022, à 22:17, Yann E. MORIN a écrit :
> 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...

I thought it would be simple, but it is not, because when building the go toolchain, I don't know how to pass build tags for the stdlib packages (I have tried using GO_GCFLAGS and GO_DISTFLAGS, but neither fit the bill). I'll remove this comment from v2.

I mostly wanted to get the discussion going on this particular issue, but maybe it's not that important. I checked the auto-builders error, and there is only one occurrence.

Regards,

Anisse

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-11-21 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 18:19 [Buildroot] [PATCH RFC] package/go: disable cgo support with static libs Anisse Astier
2022-11-21  6:27 ` Baruch Siach via buildroot
2022-11-21 22:42   ` Anisse Astier
2022-11-21 21:17 ` Yann E. MORIN
2022-11-21 22:43   ` Anisse Astier

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.