[pacman-dev] build failure: _FORTIFY_SOURCE requires compiling with optimization

Clemens Buchacher drizzd at aon.at
Sun Jul 15 18:31:43 EDT 2012


I am trying to build like this:

    ./autogen.sh
    ./configure --enable-debug --enable-git-version --prefix=$HOME/.local/pacman CFLAGS=-g

And I get during make:

    In file included from /usr/include/stdlib.h:24:0,
                     from add.c:21:
    /usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
    cc1: all warnings being treated as errors

Autoconf checks if FORTIFY_SOURCE works, but it does so without -Werror
which is later used for compiling:

    # configure.ac
    if test "x$debug" = "xyes" ; then
      GCC_FORTIFY_SOURCE_CC
      WARNING_CFLAGS="-g -Wall -Werror"

I attempted to fix this by considering WARNING_CFLAGS in
GCC_FORTIFY_SOURCE_CC, but Autoconf is a mystery to me.

In any case, it seems strange that _FORTIFY_SOURCE would be used only
with debugging while the standard library warns about its use without
optimization.

Clemens


More information about the pacman-dev mailing list