package/python-argon2-cffi: use -msse2 only when supported
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
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/
--- package/python-argon2-cffi/python-argon2-cffi.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/python-argon2-cffi/python-argon2-cffi.mk +6 -0
@@ -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))
Signature · 1 line
2.26.0
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Hello Asaf,
Quoted 5 lines · On Tue, 14 Apr 2020 13:26:21 +0300 Asaf Kahlon <[email protected]> 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 insetup.pyonly when
optimzed -> optimized
Quoted 1 line
+define
PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
optimized
package/python-argon2-cffi/python-argon2-cffi.mk PYTHON_ARGON2_CFFI_LICENSE = MIT · line 19
Quoted 4 lines
package/python-argon2-cffi/python-argon2-cffi.mk +4
-0+ $(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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Quoted 25 lines · Thomas Petazzoni
Hello Asaf,
Quoted 5 lines · On Tue, 14 Apr 2020 13:26:21 +0300 Asaf Kahlon <[email protected]> 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 insetup.pyonly whenoptimzed -> optimized
Quoted 1 line
+define
PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAGoptimized
package/python-argon2-cffi/python-argon2-cffi.mk PYTHON_ARGON2_CFFI_LICENSE = MIT · line 19
Quoted 4 lines
package/python-argon2-cffi/python-argon2-cffi.mk +4
-0+ $(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_FLAGoptimized
Quoted 4 lines
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.
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Quoted 28 lines · James Hilliard
Quoted 25 lines · Thomas Petazzoni
Hello Asaf,
Quoted 5 lines · On Tue, 14 Apr 2020 13:26:21 +0300 Asaf Kahlon <[email protected]> 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 insetup.pyonly whenoptimzed -> optimized
Quoted 1 line
+define
PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAGoptimized
package/python-argon2-cffi/python-argon2-cffi.mk PYTHON_ARGON2_CFFI_LICENSE = MIT · line 19
Quoted 4 lines
package/python-argon2-cffi/python-argon2-cffi.mk +4
-0+ $(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_FLAGoptimized
Quoted 7 lines
Quoted 4 lines
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 patchsetup.py, I'll see if I can get that working.
Oh, just noticed we'll probably still need both since argon2-cffi supports python2.
Quoted 8 lines
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Quoted 35 lines · James Hilliard
Quoted 32 lines · James Hilliard
Quoted 29 lines · Thomas Petazzoni
Hello Asaf,
Quoted 5 lines · On Tue, 14 Apr 2020 13:26:21 +0300 Asaf Kahlon <[email protected]> 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 insetup.pyonly whenoptimzed -> optimized
Quoted 1 line
+define
PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAGoptimized
package/python-argon2-cffi/python-argon2-cffi.mk PYTHON_ARGON2_CFFI_LICENSE = MIT · line 19
Quoted 4 lines
package/python-argon2-cffi/python-argon2-cffi.mk +4
-0+ $(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_FLAGoptimized
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.
Quoted 5 lines
Quoted 3 lines
Ah, that looks better, I had submitted
https://github.com/hynek/argon2-cffi/pull/59
to avoid having to patchsetup.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.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Hello,
Quoted 5 lines · On Wed, 15 Apr 2020 16:00:58 -0600 James Hilliard <[email protected]>…
Nevermind, that comment appears to be totally inaccurate as Python 3.6's CCompiler
does not actually have ahas_flagmethod at all, however we can just include the function which seems to work. I've updated my pull request with a reworked version ofhas_flagwhich 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
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
Quoted 6 lines · Thomas Petazzoni
Hello,
On Wed, 15 Apr 2020 16:00:58 -0600
James Hilliard <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Nevermind, that comment appears to be totally inaccurate as Python 3.6's CCompiler
does not actually have ahas_flagmethod at all, however we can just include the function which seems to work. I've updated my pull request with a reworked version ofhas_flagwhich 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
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/1 package/python-argon2-cffi: use -msse2 only when supported
In reply to Asaf KahlonI 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.
Quoted 34 lines · Asaf Kahlon
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 insetup.pyonly when we know SSE2 is supported.Fixes:
http://autobuild.buildroot.net/results/8c8aee8c8a0062575f489042bb11cc8515cbe48c/Signed-off-by Asaf Kahlon <[email protected]>--- package/python-argon2-cffi/python-argon2-cffi.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/python-argon2-cffi/python-argon2-cffi.mk +6
-1@@ -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