autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Autoconf does not like "-D_FORTIFY_SOURCE=2 -O2"


From: Anatol Pomozov
Subject: Autoconf does not like "-D_FORTIFY_SOURCE=2 -O2"
Date: Tue, 7 May 2013 20:49:57 -0700

Hi,

Linux Arch distributive recently added following compilation flags to
CPPFLAGS: "-D_FORTIFY_SOURCE=2 -O2". Unfortunately it breaks autoconf based
projects such as gdb, gcc, ...


The issue is that autoconf compiles some programs to find whether system
has headers. And to compile it uses only preprocessor defines from CPPFLAGS
(-D_FORTIFY_SOURCE=2 in case of Arch). recent versions of glibc produces a
warning when it compiles apps with _FORTIFY_SOURCE but without -O2.

Here is a simple application

#include <stdlib.h>
int main(void) { return 0; }

that compiles fine in Ubuntu LTS (glibc 2.15) but produces a warning on
Arch (glibc 2.17)

$ gcc -D_FORTIFY_SOURCE=2 a.c
In file included from /usr/include/stdlib.h:24:0,
                 from a.c:1:
/usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires
compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)

The warning itself was introduced in this glibc commit:
http://sourceware.org/git/?p=glibc.git;a=commit;f=include/features.h;h=05c2c9618f583ea4acd69b3fe5ae2a2922dd2ddc


And it seems autoconf does not like the warning, it treats it as "there is
a problem with header, so header does not exist on this system". And it is
wrong - header exists and it is fine, it just does not like the flags set.

It sounds like an issue in autoconf, it should handle the warning
correctly, or leave -O2 if _FORTIFY_SOURCE is present, or remove
_FORTIFY_SOURCE. In any case autoconf should  find the stdlib header even
if _FORTIFY_SOURCE is present in CPPFLAGS.



Here is additional info from Arch developers:
http://permalink.gmane.org/gmane.linux.arch.general/48295
https://mailman.archlinux.org/pipermail/arch-dev-public/2013-April/024776.html

compilation issue in RedHad's crash tool:
https://www.redhat.com/archives/crash-utility/2013-April/msg00015.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]