[Buildroot] [git commit branch/2023.11.x] package/freeradius-server: fix python3 build with -Ofast

Peter Korsgaard peter at korsgaard.com
Fri Mar 1 08:36:05 UTC 2024


commit: https://git.buildroot.net/buildroot/commit/?id=a248e08917c24ec951eb31a33d98fe87b28a54bb
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2023.11.x

Fix the following python3 build failure with -Ofast raised since commit
4513f5198a8f24af7bd24fdfc1ede143eb4e844a:

powerpc64-buildroot-linux-gnu-gcc.br_real: error: ast: linker input file not found: No such file or directory

Fixes:
 - http://autobuild.buildroot.org/results/904c43241b99a8d848c1891cb5af132a291311b4

Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
(cherry picked from commit ef199d362985031d473754c42a64f7ab2e9e57d1)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 ...c-modules-rlm_python-fix-build-with-Ofast.patch | 49 ++++++++++++++++++++++
 package/freeradius-server/freeradius-server.mk     |  6 +++
 2 files changed, 55 insertions(+)

diff --git a/package/freeradius-server/0009-src-modules-rlm_python-fix-build-with-Ofast.patch b/package/freeradius-server/0009-src-modules-rlm_python-fix-build-with-Ofast.patch
new file mode 100644
index 0000000000..c92b4171d2
--- /dev/null
+++ b/package/freeradius-server/0009-src-modules-rlm_python-fix-build-with-Ofast.patch
@@ -0,0 +1,49 @@
+From 963edf3f87d34e274885d9cc448651d8a1601a6f Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Date: Thu, 11 Jan 2024 17:38:41 +0100
+Subject: [PATCH] src/modules/rlm_python: fix build with -Ofast
+
+Stripping logic wrongly translates -Ofast into ast resulting in the
+following build failure:
+
+configure: /home/fabrice/buildroot/output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/bin/python3-config's cflags were "-I/home/fabrice/buildroot/output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/python3.11 -I/home/fabrice/buildroot/output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/python3.11  -Wsign-compare -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Ofast -g0 -D_FORTIFY_SOURCE=2 -DNDEBUG -g -fwrapv -O3 -Wall"
+configure: Sanitized cflags were " -isystem/home/fabrice/buildroot/output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/python3.11 -isystem/home/fabrice/buildroot/output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/python3.11   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  ast  -D_FORTIFY_SOURCE=2 -fwrapv  "
+
+[...]
+
+powerpc64-buildroot-linux-gnu-gcc.br_real: error: ast: linker input file not found: No such file or directory
+
+Fixes:
+ - http://autobuild.buildroot.org/results/904c43241b99a8d848c1891cb5af132a291311b4
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Upstream: https://github.com/FreeRADIUS/freeradius-server/pull/5263
+---
+ src/modules/rlm_python/configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/modules/rlm_python3/configure.ac b/src/modules/rlm_python3/configure.ac
+index e2f74574fb..ee30b324d9 100644
+--- a/src/modules/rlm_python3/configure.ac
++++ b/src/modules/rlm_python3/configure.ac
+@@ -59,7 +59,7 @@ else
+ 
+ 	dnl # Convert -I to -isystem to get rid of warnings about issues in Python headers
+ 	dnl # Strip -systemroot
+-	dnl # Strip optimisation flags (-O[0-9]?). We decide our optimisation level, not python.
++	dnl # Strip optimisation flags (-O[0-9|fast]?). We decide our optimisation level, not python.
+ 	dnl # -D_FORTIFY_SOURCE needs -O.
+ 	dnl # Strip debug symbol flags (-g[0-9]?). We decide on debugging symbols, not python
+ 	dnl # Strip -W*, we decide what warnings are important
+@@ -73,7 +73,7 @@ else
+ 	mod_cflags=`echo " $python_cflags" | sed -e '\
+ 		s/ -I/ -isystem/g;\
+ 		s/ -isysroot[[ =]]\{0,1\}[[^-]]*/ /g;\
+-		s/ -O[[^[[:blank:]]]]*/ /g;\
++		s/ -O[[^[[:blank:]]*]]*/ /g;\
+ 		s/ -Wp,-D_FORTIFY_SOURCE=[[[:digit:]]]/ /g;\
+ 		s/ -g[[^ ]]*/ /g;\
+ 		s/ -W[[^ ]]*/ /g;\
+-- 
+2.43.0
+
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
index 16a817b680..1b5751d753 100644
--- a/package/freeradius-server/freeradius-server.mk
+++ b/package/freeradius-server/freeradius-server.mk
@@ -21,6 +21,12 @@ define FREERADIUS_SERVER_RUN_KRB5_AUTORECONF
 endef
 FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_RUN_KRB5_AUTORECONF
 
+# We're patching src/modules/rlm_python3/configure.ac
+define FREERADIUS_SERVER_RUN_PYTHON3_AUTORECONF
+	cd $(@D)/src/modules/rlm_python3; $(AUTORECONF) -I$(@D)/m4
+endef
+FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_RUN_PYTHON3_AUTORECONF
+
 # some compiler checks are not supported while cross compiling.
 # instead of removing those checks, we cache the answers
 FREERADIUS_SERVER_CONF_OPTS += \



More information about the buildroot mailing list