Re: Current "CPPFLAGS=-D_FORTIFY_SOURCE=2" break some builds

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



On 08/05/13 08:10, Anatol Pomozov wrote:
> Hi, Allan
> 
> 
> On Mon, May 6, 2013 at 3:34 PM, Allan McRae <allan@xxxxxxxxxxxxx> wrote:
> 
>> On 07/05/13 06:20, Leonid Isaev wrote:
>>> On Mon, 6 May 2013 16:01:30 -0400
>>> Eric Bélanger <snowmaniscool@xxxxxxxxx> wrote:
>>>
>>>> On Mon, May 6, 2013 at 3:45 PM, Leonid Isaev <lisaev@xxxxxxxxxxxx>
>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>         With gcc 4.8.0-4 I can no longer build core/links package from
>> ABS,
>>>>> with SSL support. The issue is _not_related to makepkg (as I originally
>>>>> thought), even plain ./configure fails if I export
>>>>> CPPFLAGS=-D_FORTIFY_SOURCE=2, regardless of the content of
>> {C,CXX,LD}FLAGS.
>>>>> Here is the error:
>>>>> --------------------
>>>>> $ ./configure --with-ssl
>>>>> [ ... ]
>>>>> checking for openssl... yes
>>>>> checking OPENSSL_CFLAGS...
>>>>> checking OPENSSL_LIBS... -lssl -lcrypto
>>>>> checking for OpenSSL... no
>>>>> checking for OpenSSL... no
>>>>> configure: error: OpenSSL not found
>>>>> $ cat config.log
>>>>> [ ... ]
>>>>> configure:8095: checking for openssl
>>>>> configure:8102: checking OPENSSL_CFLAGS
>>>>> configure:8107: checking OPENSSL_LIBS
>>>>> configure:8139: checking for OpenSSL
>>>>> configure:8150: gcc -o conftest -g -O2 -D_FORTIFY_SOURCE=2   conftest.c
>>>>> -lssl
>>>>> -lcrypto  -lm  1>&5
>>>>> In file included from configure:8143:0:
>>>>> confdefs.h:8:16: error: duplicate 'unsigned'
>>>>>  #define size_t unsigned
>>>>>                 ^
>>>>> configure: failed program was:
>>>>> #line 8143 "configure"
>>>>> #include "confdefs.h"
>>>>> #include <openssl/ssl.h>
>>>>> int main() {
>>>>> SSLeay_add_ssl_algorithms()
>>>>> ; return 0; }
>>>>> --------------------
>>>>>
>>>>> With gcc 4.7.2 all builds fine with Arch's default makepkg.conf, i.e.
>> no
>>>>> "duplicate unsigned error". Also, unsetting CPPFLAGS allows a
>> successfull
>>>>> build.
>>>>>
>>>>> Since core/links has been successfully rebuilt, what was the gcc
>> version?
>>>>> ANd
>>>>> can anyone else confirm the above issue?
>>>>>
>>>>> TIA,
>>>>> L.
>>>>>
>>>>>
>>>> Aready fixed in links in testing. Just add a prepare function with:
>>>>   sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" configure
>>>>
>>>
>>> I see, thank you. Alternatively one could simply do CPPFLAGS+=" -O2" in
>>> PKGBUILD...
>>>
>>> I'm still confused though: are we supposed to pass -On flags to cpp now
>> (this
>>> is even mentioned against in the configure script)? Or is it still a
>>> gcc/glibc problem?
>>>
>>
>> The reason we do the sed is so -O2 is not passed with CPPFLAGS during
>> the actual built.  This is just working around an autoconf limitation.
>>
> 
> Could you please share more info about autoconf limitation? It is not clear
> for me why autoconf does not pass -O2. And why it is needed when
> -D_FORTIFY_SOURCE=2 is enabled. Is it a bug that reported to autoconf
> project? Or maybe it is some fundamental issue that Arch packages will live
> forever?
> 

In short, autoconf is making broken assumptions about warnings given of
by gcc.  Autoconf checks for headers by looking for a warning from gcc
when it is missing - but not a specific warning, any warning...
-D_FORTIFY_SOURCE=2 gives a warning when is it not used with
optimization so the header check fails incorrectly.   Autoconf should
not pass -O2 with CPPFLAGS because it is not a preprocessor flag.

Note that not all software that uses autoconf is affected.  Some do not
pass CPPFLAGS when testing for headers.

Allan



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux