sagemath / cysignals

cysignals: interrupt and signal handling for Cython. Source repository for https://pypi.org/project/cysignals/
GNU Lesser General Public License v3.0
43 stars 23 forks source link

cysignals install fails on Fedora with system python3 #120

Closed mkoeppe closed 4 years ago

mkoeppe commented 4 years ago

cysignals tries to make sure that _FORTIFY_SOURCE is undefined by using Extension(undef_macros=...) (https://github.com/sagemath/cysignals/blob/master/setup.py#L46). distutils.ccompiler.CCompiler.gen_preprocess_options generates the compiler flag -U_FORTIFY_SOURCE from that.

However, Fedora uses -Wp,-D_FORTIFY_SOURCE=2, which is passed directly to the C preprocessor and overrides the -U flag.

See https://trac.sagemath.org/ticket/29473

jdemeyer commented 4 years ago

Duplicate of #80. I'm open to pull requests, provided that they don't break anything on other systems.

First of all, cysignals really doesn't work with _FORTIFY_SOURCE since it abuses the stack in ways that violate some -D_FORTIFY_SOURCE` checks.

The best solution would be for Cython to allow adding arbitrary code in the beginning of the generated .c file. Then we could simply write

#undef _FORTIFY_SOURCE

there.