From 481b1985431230884be72696e3bdf849aa542269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 19 Jul 2024 01:18:23 +0200 Subject: [PATCH] Fix Arch build on conflicting _FORTIFY_SOURCE values --- ...d-conflicting-_FORTIFY_SOURCE-values.patch | 40 +++++++++++++++++++ archlinux/PKGBUILD.in | 1 + xen.spec.in | 2 + 3 files changed, 43 insertions(+) create mode 100644 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch diff --git a/0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch b/0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch new file mode 100644 index 00000000..07c1ca28 --- /dev/null +++ b/0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch @@ -0,0 +1,40 @@ +From 5e9e49c4f0ed9c54b63bf99d7b6a013005f94865 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Fri, 19 Jul 2024 01:15:13 +0200 +Subject: [PATCH] python: avoid conflicting _FORTIFY_SOURCE values +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The compile flags are combined from python's build config (sysconfig +module) and CFLAGS environment. If both define the _FORTIFY_SOURCE but +to different values, the build will fail. This is the case on Arch, +where Python's sysconfig has -D_FORTIFY_SOURCE=2, while Arch's +makepkg.conf has -D_FORTIFY_SOURCE=3. Resolve the config by undefining +_FORTIFY_SOURCE first, and use the value from the CFLAGS environment. +Details: +https://setuptools.pypa.io/en/latest/userguide/ext_modules.html + +Signed-off-by: Marek Marczykowski-Górecki +--- + tools/python/setup.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tools/python/setup.py b/tools/python/setup.py +index 02354f698653..a73c95a9e766 100644 +--- a/tools/python/setup.py ++++ b/tools/python/setup.py +@@ -20,6 +20,9 @@ PATH_LIBXENCTRL = XEN_ROOT + "/tools/libs/ctrl" + PATH_LIBXENGUEST = XEN_ROOT + "/tools/libs/guest" + PATH_XENSTORE = XEN_ROOT + "/tools/libs/store" + ++if "-D_FORTIFY_SOURCE=" in os.environ.get("CFLAGS", ""): ++ os.environ["CFLAGS"] = "-Wp,-U_FORTIFY_SOURCE " + os.environ["CFLAGS"] ++ + xc = Extension("xc", + extra_compile_args = extra_compile_args, + include_dirs = [ PATH_XEN, +-- +2.45.2 + diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD.in index 541fbe90..4b425b17 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD.in @@ -14,6 +14,7 @@ makedepends=(wget make gcc patch git iasl pkg-config openssl pixman python-setup provides=('xen-qubes-vm-essentials') _patches=( + 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch 1000-Do-not-access-network-during-the-build.patch 1001-hotplug-store-block-params-for-cleanup.patch 1020-xen-tools-qubes-vm.patch diff --git a/xen.spec.in b/xen.spec.in index fdff1e66..39dc5790 100644 --- a/xen.spec.in +++ b/xen.spec.in @@ -155,6 +155,8 @@ Patch0643: 0643-cpufreq-enable-HWP-by-default.patch PAtch0651: 0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch PAtch0652: 0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch +Patch0653: 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch + # S0ix support Patch0670: 0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch Patch0671: 0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch