Skip to contentSkip to conversation

toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472

PATCH In review Giulio Benetti 1 participant 3 messages Sep 23, 2021 – Sep 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_102472

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

---
 toolchain/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
toolchain/Config.in +7 -0
index 8b01067105..adb4d63759 100644
@@ -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
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/python-uvloop: work-around m68k toolchain infinite loop

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/

---
 ...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
package/python-uvloop/0001-setup.py-allow-to-override-extra_compile_args.patch new file +42 -0
new file mode 100644
index 0000000000..94f1ecf93d
@@ -0,0 +1,42 @@
+From b415e5175500117950f56b5eded1e82acac49c16 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+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 <[email protected]>
+---
+ 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
+
package/python-uvloop/python-uvloop.mk +4 -0
index ff98d747b2..a0dc554aae 100644
@@ -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))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Giulio Benetti

Hi All,

Quoted 3 lines · Giulio Benetti

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

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 17 lines

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

---
  toolchain/Config.in | 7 +++++++
  1 file changed, 7 insertions(+)
toolchain/Config.in +0 -0
index 8b01067105..adb4d63759 100644
@@ -210,6 +210,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_101952
  	bool
  	default y if BR2_sh4
 

toolchain/Config.in config BR2_TOOLCHAIN_HAS_GCC_BUG_101952 · line 222

Quoted 10 lines
toolchain/Config.in +7 -0
+# 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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot