buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472
@ 2021-09-23 16:45 Giulio Benetti
  2021-09-23 16:45 ` [Buildroot] [PATCH 2/2] package/python-uvloop: work-around m68k toolchain infinite loop Giulio Benetti
  2021-09-24 21:27 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti
  0 siblings, 2 replies; 3+ messages in thread
From: Giulio Benetti @ 2021-09-23 16:45 UTC (permalink / raw)
  To: buildroot
  Cc: Asaf Kahlon, Thomas Petazzoni, Romain Naour, Giulio Benetti,
	Thomas De Schampheleire

python-uvloop package hang while building for the m68k architecture with
optimization enabled with gcc = 11.2.0:
http://autobuild.buildroot.net/results/17d/17d6e6422abadcd6313c430c40f2a5d7162dbbd3/

It's been reported upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102472

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 toolchain/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 8b01067105..adb4d63759 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -210,6 +210,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_101952
 	bool
 	default y if BR2_sh4
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102472
+# ICE: on m68k it enters an infinite loop
+# This bug still exists in gcc = 11.2.0
+config BR2_TOOLCHAIN_HAS_GCC_BUG_102472
+	bool
+	default y if BR2_m68k
+
 config BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	bool
 
-- 
2.25.1

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

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

* [Buildroot] [PATCH 2/2] package/python-uvloop: work-around m68k toolchain infinite loop
  2021-09-23 16:45 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti
@ 2021-09-23 16:45 ` Giulio Benetti
  2021-09-24 21:27 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti
  1 sibling, 0 replies; 3+ messages in thread
From: Giulio Benetti @ 2021-09-23 16:45 UTC (permalink / raw)
  To: buildroot
  Cc: Asaf Kahlon, Thomas Petazzoni, Romain Naour, Giulio Benetti,
	Thomas De Schampheleire

Add patch[1] to allow overriding the default -O2 flag always appended at
the end of the python Extension. This is needed to pass -O0 to gcc to
work-around the gcc bug 102472. So when
BR2_TOOLCHAIN_HAS_GCC_BUG_102472=y let's pass -O0 to MODULES_CFLAGS

Pending patch:
[1]: https://github.com/MagicStack/uvloop/pull/443

Fixes:
http://autobuild.buildroot.net/results/17d/17d6e6422abadcd6313c430c40f2a5d7162dbbd3/

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 ...allow-to-override-extra_compile_args.patch | 42 +++++++++++++++++++
 package/python-uvloop/python-uvloop.mk        |  4 ++
 2 files changed, 46 insertions(+)
 create mode 100644 package/python-uvloop/0001-setup.py-allow-to-override-extra_compile_args.patch

diff --git a/package/python-uvloop/0001-setup.py-allow-to-override-extra_compile_args.patch b/package/python-uvloop/0001-setup.py-allow-to-override-extra_compile_args.patch
new file mode 100644
index 0000000000..94f1ecf93d
--- /dev/null
+++ b/package/python-uvloop/0001-setup.py-allow-to-override-extra_compile_args.patch
@@ -0,0 +1,42 @@
+From b415e5175500117950f56b5eded1e82acac49c16 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Thu, 23 Sep 2021 16:47:55 +0200
+Subject: [PATCH] setup.py: allow to override extra_compile_args
+
+At the moment extra_compile_args is set to -O2 by default. But m68k
+toolchain has a bug that when trying to build Extension uvloop.loop enters
+an infinite loop1. So we need to override -O2 with -O0 to make it
+work. So let's getenv('MODULES_CFLAGS') and assign it to local
+MODULES_CFLAGS (former CFLAGS) and assign it to extra_compile_args. If
+not MODULES_CFLAGS is found then -O2 is kept as default.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ setup.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index eae4910..ec23d13 100644
+--- a/setup.py
++++ b/setup.py
+@@ -55,7 +55,7 @@ EXTRA_DEPENDENCIES = {
+ 
+ 
+ MACHINE = platform.machine()
+-CFLAGS = ['-O2']
++MODULES_CFLAGS = [os.getenv('MODULES_CFLAGS', '-O2')]
+ _ROOT = pathlib.Path(__file__).parent
+ LIBUV_DIR = str(_ROOT / 'vendor' / 'libuv')
+ LIBUV_BUILD_DIR = str(_ROOT / 'build' / 'libuv-{}'.format(MACHINE))
+@@ -301,7 +301,7 @@ setup(
+             sources=[
+                 "uvloop/loop.pyx",
+             ],
+-            extra_compile_args=CFLAGS
++            extra_compile_args=MODULES_CFLAGS
+         ),
+     ],
+     classifiers=[
+-- 
+2.25.1
+
diff --git a/package/python-uvloop/python-uvloop.mk b/package/python-uvloop/python-uvloop.mk
index ff98d747b2..a0dc554aae 100644
--- a/package/python-uvloop/python-uvloop.mk
+++ b/package/python-uvloop/python-uvloop.mk
@@ -14,4 +14,8 @@ PYTHON_UVLOOP_BUILD_OPTS = build_ext --inplace --use-system-libuv
 PYTHON_UVLOOP_INSTALL_TARGET_OPTS = build_ext --inplace --use-system-libuv
 PYTHON_UVLOOP_DEPENDENCIES = libuv
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_102472),y)
+PYTHON_UVLOOP_ENV = MODULES_CFLAGS="-O0"
+endif
+
 $(eval $(python-package))
-- 
2.25.1

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

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

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472
  2021-09-23 16:45 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti
  2021-09-23 16:45 ` [Buildroot] [PATCH 2/2] package/python-uvloop: work-around m68k toolchain infinite loop Giulio Benetti
@ 2021-09-24 21:27 ` Giulio Benetti
  1 sibling, 0 replies; 3+ messages in thread
From: Giulio Benetti @ 2021-09-24 21:27 UTC (permalink / raw)
  To: buildroot
  Cc: Asaf Kahlon, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

Hi All,

On 9/23/21 6:45 PM, Giulio Benetti wrote:
> python-uvloop package hang while building for the m68k architecture with
> optimization enabled with gcc = 11.2.0:
> http://autobuild.buildroot.net/results/17d/17d6e6422abadcd6313c430c40f2a5d7162dbbd3/

Here it's not true. I've found out that it doesn't really time out, it 
only takes a lot to build with optimization enabled since loop.c file is 
7Mb big. So please drop this patch and the next one. I've marked them 
both as rejected in patchwork already.

Sorry for the noise!

Kind regards
-- 
Giulio Benetti
Benetti Engineering sas

> It's been reported upstream:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102472
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>   toolchain/Config.in | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index 8b01067105..adb4d63759 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -210,6 +210,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_101952
>   	bool
>   	default y if BR2_sh4
>   
> +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102472
> +# ICE: on m68k it enters an infinite loop
> +# This bug still exists in gcc = 11.2.0
> +config BR2_TOOLCHAIN_HAS_GCC_BUG_102472
> +	bool
> +	default y if BR2_m68k
> +
>   config BR2_TOOLCHAIN_HAS_NATIVE_RPC
>   	bool
>   
> 

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

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

end of thread, other threads:[~2021-09-24 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 16:45 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti
2021-09-23 16:45 ` [Buildroot] [PATCH 2/2] package/python-uvloop: work-around m68k toolchain infinite loop Giulio Benetti
2021-09-24 21:27 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472 Giulio Benetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).