All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
@ 2020-04-14 10:26 Asaf Kahlon
  2020-04-15 20:10 ` Thomas Petazzoni
  2020-04-22  6:54 ` James Hilliard
  0 siblings, 2 replies; 8+ messages in thread
From: Asaf Kahlon @ 2020-04-14 10:26 UTC (permalink / raw)
  To: buildroot

The package adds the '-msse2' flag according to the result of the
pythonic "platform.machine()" statement, which runs on the host
and doesn't necessarily reflects the existence of this flag on
the target compiler.
Hence, we'll set the 'optimzed' variable in setup.py only when
we know SSE2 is supported.

Fixes:
  http://autobuild.buildroot.net/results/8c8aee8c8a0062575f489042bb11cc8515cbe48c/

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
 package/python-argon2-cffi/python-argon2-cffi.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/python-argon2-cffi/python-argon2-cffi.mk b/package/python-argon2-cffi/python-argon2-cffi.mk
index 099574e9c3..9f73e75c1e 100644
--- a/package/python-argon2-cffi/python-argon2-cffi.mk
+++ b/package/python-argon2-cffi/python-argon2-cffi.mk
@@ -12,4 +12,10 @@ PYTHON_ARGON2_CFFI_LICENSE = MIT
 PYTHON_ARGON2_CFFI_LICENSE_FILES = LICENSE
 PYTHON_ARGON2_CFFI_DEPENDENCIES = host-python-cffi
 
+define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
+        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
+endef
+
+PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
+
 $(eval $(python-package))
-- 
2.26.0

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-14 10:26 [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported Asaf Kahlon
@ 2020-04-15 20:10 ` Thomas Petazzoni
  2020-04-15 20:20   ` James Hilliard
  2020-04-22  6:54 ` James Hilliard
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2020-04-15 20:10 UTC (permalink / raw)
  To: buildroot

Hello Asaf,

On Tue, 14 Apr 2020 13:26:21 +0300
Asaf Kahlon <asafka7@gmail.com> wrote:

> The package adds the '-msse2' flag according to the result of the
> pythonic "platform.machine()" statement, which runs on the host
> and doesn't necessarily reflects the existence of this flag on
> the target compiler.
> Hence, we'll set the 'optimzed' variable in setup.py only when

optimzed -> optimized

> +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG

optimized

> +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> +endef
> +
> +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG

optimized

But can't we do better here ? Check if the compiler supports the -msse2
flag ? See
https://github.com/pybind/python_example/blob/master/setup.py#L38 for
an example on how to do that.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-15 20:10 ` Thomas Petazzoni
@ 2020-04-15 20:20   ` James Hilliard
  2020-04-15 20:22     ` James Hilliard
  0 siblings, 1 reply; 8+ messages in thread
From: James Hilliard @ 2020-04-15 20:20 UTC (permalink / raw)
  To: buildroot

On Wed, Apr 15, 2020 at 2:10 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Asaf,
>
> On Tue, 14 Apr 2020 13:26:21 +0300
> Asaf Kahlon <asafka7@gmail.com> wrote:
>
> > The package adds the '-msse2' flag according to the result of the
> > pythonic "platform.machine()" statement, which runs on the host
> > and doesn't necessarily reflects the existence of this flag on
> > the target compiler.
> > Hence, we'll set the 'optimzed' variable in setup.py only when
>
> optimzed -> optimized
>
> > +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
>
> optimized
>
> > +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> > +endef
> > +
> > +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
>
> optimized
>
> But can't we do better here ? Check if the compiler supports the -msse2
> flag ? See
> https://github.com/pybind/python_example/blob/master/setup.py#L38 for
> an example on how to do that.
Ah, that looks better, I had submitted
https://github.com/hynek/argon2-cffi/pull/59
to avoid having to patch setup.py, I'll see if I can get that working.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-15 20:20   ` James Hilliard
@ 2020-04-15 20:22     ` James Hilliard
  2020-04-15 22:00       ` James Hilliard
  0 siblings, 1 reply; 8+ messages in thread
From: James Hilliard @ 2020-04-15 20:22 UTC (permalink / raw)
  To: buildroot

On Wed, Apr 15, 2020 at 2:20 PM James Hilliard
<james.hilliard1@gmail.com> wrote:
>
> On Wed, Apr 15, 2020 at 2:10 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello Asaf,
> >
> > On Tue, 14 Apr 2020 13:26:21 +0300
> > Asaf Kahlon <asafka7@gmail.com> wrote:
> >
> > > The package adds the '-msse2' flag according to the result of the
> > > pythonic "platform.machine()" statement, which runs on the host
> > > and doesn't necessarily reflects the existence of this flag on
> > > the target compiler.
> > > Hence, we'll set the 'optimzed' variable in setup.py only when
> >
> > optimzed -> optimized
> >
> > > +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> >
> > optimized
> >
> > > +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> > > +endef
> > > +
> > > +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> >
> > optimized
> >
> > But can't we do better here ? Check if the compiler supports the -msse2
> > flag ? See
> > https://github.com/pybind/python_example/blob/master/setup.py#L38 for
> > an example on how to do that.
> Ah, that looks better, I had submitted
> https://github.com/hynek/argon2-cffi/pull/59
> to avoid having to patch setup.py, I'll see if I can get that working.
Oh, just noticed we'll probably still need both since argon2-cffi
supports python2.
> >
> > Thanks!
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-15 20:22     ` James Hilliard
@ 2020-04-15 22:00       ` James Hilliard
  2020-04-19 14:00         ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: James Hilliard @ 2020-04-15 22:00 UTC (permalink / raw)
  To: buildroot

On Wed, Apr 15, 2020 at 2:22 PM James Hilliard
<james.hilliard1@gmail.com> wrote:
>
> On Wed, Apr 15, 2020 at 2:20 PM James Hilliard
> <james.hilliard1@gmail.com> wrote:
> >
> > On Wed, Apr 15, 2020 at 2:10 PM Thomas Petazzoni
> > <thomas.petazzoni@bootlin.com> wrote:
> > >
> > > Hello Asaf,
> > >
> > > On Tue, 14 Apr 2020 13:26:21 +0300
> > > Asaf Kahlon <asafka7@gmail.com> wrote:
> > >
> > > > The package adds the '-msse2' flag according to the result of the
> > > > pythonic "platform.machine()" statement, which runs on the host
> > > > and doesn't necessarily reflects the existence of this flag on
> > > > the target compiler.
> > > > Hence, we'll set the 'optimzed' variable in setup.py only when
> > >
> > > optimzed -> optimized
> > >
> > > > +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> > >
> > > optimized
> > >
> > > > +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> > > > +endef
> > > > +
> > > > +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> > >
> > > optimized
> > >
> > > But can't we do better here ? Check if the compiler supports the -msse2
> > > flag ? See
> > > https://github.com/pybind/python_example/blob/master/setup.py#L38 for
> > > an example on how to do that.
> > Ah, that looks better, I had submitted
> > https://github.com/hynek/argon2-cffi/pull/59
> > to avoid having to patch setup.py, I'll see if I can get that working.
> Oh, just noticed we'll probably still need both since argon2-cffi
> supports python2.
Nevermind, that comment appears to be totally inaccurate as Python
3.6's CCompiler
does not actually have a has_flag method at all, however we can just include the
function which seems to work. I've updated my pull request with a reworked
version of has_flag which seems to work.
> > >
> > > Thanks!
> > >
> > > Thomas
> > > --
> > > Thomas Petazzoni, CTO, Bootlin
> > > Embedded Linux and Kernel engineering
> > > https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-15 22:00       ` James Hilliard
@ 2020-04-19 14:00         ` Thomas Petazzoni
  2020-04-19 21:36           ` James Hilliard
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2020-04-19 14:00 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 15 Apr 2020 16:00:58 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> Nevermind, that comment appears to be totally inaccurate as Python
> 3.6's CCompiler
> does not actually have a has_flag method at all, however we can just include the
> function which seems to work. I've updated my pull request with a reworked
> version of has_flag which seems to work.

Do you have some news about the upstream patch to fix this issue ? It
would be good to fix it in Buildroot, as the build continues to fail.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-19 14:00         ` Thomas Petazzoni
@ 2020-04-19 21:36           ` James Hilliard
  0 siblings, 0 replies; 8+ messages in thread
From: James Hilliard @ 2020-04-19 21:36 UTC (permalink / raw)
  To: buildroot

On Sun, Apr 19, 2020 at 8:00 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Wed, 15 Apr 2020 16:00:58 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > Nevermind, that comment appears to be totally inaccurate as Python
> > 3.6's CCompiler
> > does not actually have a has_flag method at all, however we can just include the
> > function which seems to work. I've updated my pull request with a reworked
> > version of has_flag which seems to work.
>
> Do you have some news about the upstream patch to fix this issue ? It
> would be good to fix it in Buildroot, as the build continues to fail.
I was waiting on upstream to merge the patch I sent but it should fix this.
https://github.com/hynek/argon2-cffi/pull/59
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
  2020-04-14 10:26 [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported Asaf Kahlon
  2020-04-15 20:10 ` Thomas Petazzoni
@ 2020-04-22  6:54 ` James Hilliard
  1 sibling, 0 replies; 8+ messages in thread
From: James Hilliard @ 2020-04-22  6:54 UTC (permalink / raw)
  To: buildroot

I think we should maybe just merge this for now so that autobuilders
stop failing,
once my upstream PR is merged and the package is updated we can then remove
this workaround.

On Tue, Apr 14, 2020 at 4:27 AM Asaf Kahlon <asafka7@gmail.com> wrote:
>
> The package adds the '-msse2' flag according to the result of the
> pythonic "platform.machine()" statement, which runs on the host
> and doesn't necessarily reflects the existence of this flag on
> the target compiler.
> Hence, we'll set the 'optimzed' variable in setup.py only when
> we know SSE2 is supported.
>
> Fixes:
>   http://autobuild.buildroot.net/results/8c8aee8c8a0062575f489042bb11cc8515cbe48c/
>
> Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
> ---
>  package/python-argon2-cffi/python-argon2-cffi.mk | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/package/python-argon2-cffi/python-argon2-cffi.mk b/package/python-argon2-cffi/python-argon2-cffi.mk
> index 099574e9c3..9f73e75c1e 100644
> --- a/package/python-argon2-cffi/python-argon2-cffi.mk
> +++ b/package/python-argon2-cffi/python-argon2-cffi.mk
> @@ -12,4 +12,10 @@ PYTHON_ARGON2_CFFI_LICENSE = MIT
>  PYTHON_ARGON2_CFFI_LICENSE_FILES = LICENSE
>  PYTHON_ARGON2_CFFI_DEPENDENCIES = host-python-cffi
>
> +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> +endef
> +
> +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> +
>  $(eval $(python-package))
> --
> 2.26.0
>

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

end of thread, other threads:[~2020-04-22  6:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 10:26 [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported Asaf Kahlon
2020-04-15 20:10 ` Thomas Petazzoni
2020-04-15 20:20   ` James Hilliard
2020-04-15 20:22     ` James Hilliard
2020-04-15 22:00       ` James Hilliard
2020-04-19 14:00         ` Thomas Petazzoni
2020-04-19 21:36           ` James Hilliard
2020-04-22  6:54 ` James Hilliard

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.