[arch-dev-public] Build issues due to -D_FORTIFY_SOURCE=2 in CPPFLAGS

Rashif Ray Rahman schiv at archlinux.org
Mon Apr 8 10:50:18 EDT 2013

On 8 April 2013 15:18, Thomas Bächler <thomas at archlinux.org> wrote:
> Am 08.04.2013 08:54, schrieb Allan McRae:
>> What do we do?   Do we need to ignore the fact the this should be in
>> CPPFLAGS and move it back to C{,XX}FLAGS?
>> The other options is for packages that are affected by this to unset the
>> CPPFLAGS and add it to CFLAGS in the PKGBUILD, but I have no idea how
>> many packages this affects.  What portion of KDE and GNOME were built
>> with pacman-4.1?

So, as far as I understand, we're supposed to identify this issue from
lines like:

warning: #warning _FORTIFY_SOURCE requires compiling with optimization
(-O) [-Wcpp]

(e.g. output from i686 build of unsupported package gcc-gcj)

But should there be any case where this warning is not shown? Say, for
e.g., if -Wcpp or -Wall is not used? ...

> CPPFLAGS="$CPPFLAGS -O2" - problem solved.

... If not, then we don't really need any kind of conditioning to
recognise it. Editing buildscripts to unset CPPFLAGS (or append -O[n]
to it) would be fine in that case, but if there are non-intrusive
alternatives we should pursue them.

Deciding on [n] for O[n] is really not the business of the
buildscript, and you'd want to move the affected flag (back) to
C{,XX}FLAGS if you don't append. You can do either of them properly,
sure, but not as a clean one-liner (you'd have to at least grep [n]
from somewhere).


More information about the arch-dev-public mailing list