Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cysignals does not compile with -Wp,-D_FORTIFY_SOURCE=2 #80

Open
jamesjrg opened this issue Mar 23, 2018 · 9 comments
Open

cysignals does not compile with -Wp,-D_FORTIFY_SOURCE=2 #80

jamesjrg opened this issue Mar 23, 2018 · 9 comments

Comments

@jamesjrg
Copy link

jamesjrg commented Mar 23, 2018

This is the gcc command created by pip install version 1.6.9 on an Amazon Linux AMI:

gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -U_FORTIFY_SOURCE -Isrc/cysignals -Ibuild/src -Ibuild/src/cysignals -I/usr/include/python3.4m -c build/src/cysignals/signals.c -o build/temp.linux-x86_64-3.4/build/src/cysignals/signals.o

And the error:

    In file included from build/src/cysignals/signals.c:602:0:
    build/src/cysignals/implementation.c:27:2: error: #error "cysignals must be compiled without _FORTIFY_SOURCE"
     #error "cysignals must be compiled without _FORTIFY_SOURCE

So maybe U_FORTIFY_SOURCE doesn't work in conjunction with also setting D_FORTIFY_SOURCE?

@jdemeyer
Copy link
Collaborator

-Wp,-D_FORTIFY_SOURCE=2

Where do these flags come from?

So maybe U_FORTIFY_SOURCE doesn't work in conjunction with also setting D_FORTIFY_SOURCE?

No, the problem is -Wp,-D_FORTIFY_SOURCE=2 as opposed to -D_FORTIFY_SOURCE=2.

@jdemeyer jdemeyer changed the title Still issues with _FORTIFY_SOURCE cysignals does not compile with -Wp,-D_FORTIFY_SOURCE=2 Mar 24, 2018
@jdemeyer
Copy link
Collaborator

To be honest, I consider this a bug on your system: why are you using -Wp,-D_FORTIFY_SOURCE=2 to compile cysignals? It won't work and you are even getting a very nice explicit error message.

That doesn't mean that I refuse to fix it, but it does mean that I feel no pressure to fix it. I'm certainly open for pull requests...

@jamesjrg
Copy link
Author

I just ran "pip install cysignals" in a new virtual env on an unchanged AWS Linux AMI. I saw recent commits in this repo were designed to work around this and thought I'd report it didn't seem to work. I can work around it so not a major issue for my purposes.

@jamesjrg
Copy link
Author

Just in case anyone is interested, "-Wp,-D_FORTIFY_SOURCE=2" is in /usr/bin/python3.4m-x86_64-config, and appears in the output of import sysconfig; print(sysconfig.get_config_vars()), so I presume these are the flags that were used to compile Python in the yum repo and hence also the flags used by pip

@jdemeyer
Copy link
Collaborator

Thanks for the info. Anyway, the fix is to add -Wp,-U_FORTIFY_SOURCE to the flags to cancel the effect of -Wp,-D_FORTIFY_SOURCE=2.

@Sroose
Copy link

Sroose commented Sep 21, 2018

to run with pip:
CFLAGS="-Wp,-U_FORTIFY_SOURCE" pip install cysignals

@jdemeyer
Copy link
Collaborator

By the way, the rationale for Redhat using -Wp is

commit 1518ff2d14377c05ecf7cf9428e42964516883b4
Author: Elliot Lee <sopwith@redhat.com>
Date:   Wed Feb 9 15:09:11 2005 +0000

    Fix java builds

diff --git a/macros b/macros
index 7cbe282..18c61b5 100644
--- a/macros
+++ b/macros
@@ -151,4 +151,4 @@ unset DISPLAY\
 %__find_provides        /usr/lib/rpm/redhat/find-provides
 %__find_requires        /usr/lib/rpm/redhat/find-requires
 
-%__global_cflags       -O2 -g -pipe -D_FORTIFY_SOURCE=2
+%__global_cflags       -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2

In other words, I have no clue...

@pkochar263
Copy link

CFLAGS="-Wp,-U_FORTIFY_SOURCE" pip install cysignals

i was having the same problem in centos 7 . This solves my problem

@xjzhou
Copy link

xjzhou commented Nov 29, 2020

to run with pip:
CFLAGS="-Wp,-U_FORTIFY_SOURCE" pip install cysignals

This solves my problem in centos 7.
export CFLAGS="-Wp,-U_FORTIFY_SOURCE" && pip3 install cysignals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants