[Libreoffice-commits] core.git: external/python3

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 16 14:04:46 UTC 2020


 external/python3/ExternalProject_python3.mk |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 29d47d22c43e6adc1850b7db5880028dcd07d1b3
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Apr 16 13:58:49 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Apr 16 16:04:05 2020 +0200

    Fix passing --disable-optimized into external/python3
    
    This had originally been covered by dccf47b7f61e088622747539d1487590080da3b8
    "Build python3 with debug flags if --enable-debug", which got broken by
    eeeec33ada5923f1f534334b22c15d6e2c6f1d35 "merge --enable-selective-debuginfo
    into --enable-symbols" (which removed the definition of
    gb_Module_CURRENTMODULE_DEBUG_ENABLED without adapting its use here).
    
    But looking again, setting OPT for workdir/UnpackedTarball/python3/configure.ac
    based on our various flags doesn't seem to be such a good idea anyway:  It is
    used to specify a mixture of debuginfo (-g; which is set rather unconditionally,
    so no need for us to cater for --enable-symbols here), optimization (-fwrapv,
    -O*), and warning (-Wall) flags.  So better let
    workdir/UnpackedTarball/python3/configure.ac keep deciding for itself what flags
    to set in OPT, and then just override via CFLAGS those that do not suite us.
    (Where it appears to be a happy coincidence that the Python build system puts
    CFLAGS after OPT, so the former can override the latter.)
    
    (An alternative approach could have been to pass --with-pydebug based on e.g.
    --enable-dbgutil, as the former (a) causes OPT to include -O0 rather than -O3,
    and (b) is documented to change the ABI (see
    workdir/UnpackedTarball/python3/configure.ac: "Py_DEBUG implies assertions, but
    also changes the ABI."), so probably best fits --enable-dbgutil.  However, at
    least on Linux, --with-pydebug produces
    workdir/UnpackedTarball/python3/libpython3.7dm.so rather than
    workdir/UnpackedTarball/python3/libpython3.so, so would have required further
    modifications.  Also, in a Linux UBsan build, making ExternalProject_python3
    would have started to cause some "applying zero offset to null pointer"
    failures, but which would have been easy to fix.)
    
    (I noticed the missing -O0 when I attached gdb to an instdir/program/python.bin
    process and `py-bt` only showed "(frame information optimized out)" frames,
    which this change fixes for --disable-optimized builds.)
    
    Change-Id: I9583e60692ae7130377422062f3c6df9334d693f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92362
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 816315981a56..7e320caf9bc7 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -69,6 +69,12 @@ ifneq (,$(ENABLE_VALGRIND))
     python3_cflags += $(VALGRIND_CFLAGS)
 endif
 
+# This happens to override the -O3 in the default OPT set in
+# workdir/UnpackedTarball/python3/configure.ac while keeping the other content of that OPT intact:
+ifeq ($(ENABLE_OPTIMIZED),)
+python3_cflags += $(gb_COMPILERNOOPTFLAGS)
+endif
+
 $(call gb_ExternalProject_get_state_target,python3,build) :
 	$(call gb_Trace_StartRange,python3,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
@@ -84,9 +90,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 		--prefix=/python-inst \
 		--with-system-expat \
 		$(if $(filter AIX,$(OS)), \
-			--disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall", \
-			$(if $(gb_Module_CURRENTMODULE_DEBUG_ENABLED), \
-				OPT="$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUGINFO_FLAGS)")) \
+			--disable-ipv6 --with-threads OPT="-g0 -fwrapv -O3 -Wall") \
 		$(if $(filter MACOSX,$(OS)), \
 			$(if $(filter INTEL,$(CPUNAME)),--enable-universalsdk=$(MACOSX_SDK_PATH) \
                                 --with-universal-archs=intel \


More information about the Libreoffice-commits mailing list