package/freeradius-server: fix python3 build with -Ofast

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

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@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fabrice Fontaine 2024-01-11 20:42:42 +01:00 committed by Peter Korsgaard
parent 8f4be5c41b
commit ef199d3629
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From 963edf3f87d34e274885d9cc448651d8a1601a6f Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@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@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

View File

@ -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 += \