Skip to content

Commit

Permalink
python: avoid conflicting _FORTIFY_SOURCE values
Browse files Browse the repository at this point in the history
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

Fixes QubesOS/qubes-core-agent-linux#496 (comment)
  • Loading branch information
marmarek committed Apr 30, 2024
1 parent 2fbe383 commit 8297bac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

import os
from setuptools import setup, Extension

extra_compile_args = [ "-fno-strict-aliasing", "-Werror" ]

if "-D_FORTIFY_SOURCE=" in os.environ.get("CFLAGS", ""):
os.environ["CFLAGS"] = "-Wp,-U_FORTIFY_SOURCE " + os.environ["CFLAGS"]

PATH_INCLUDES = "../include"
PATH_LIBS = "../client"

Expand Down

0 comments on commit 8297bac

Please sign in to comment.