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

Allan McRae allan at archlinux.org
Mon Jul 16 00:38:11 EDT 2012


On 16/07/12 08:31, Clemens Buchacher wrote:
> 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.
> 

Ah...  new warning introduced by glibc-2.16.   I guess we all build with
-O2 by default until we run into an error that needs serious debugging.

Patch to follow.

Allan



More information about the pacman-dev mailing list