gnucash maint: Add _FORTIFY_SOURCE directive only when compiling with optimization enabled

John Ralls jralls at ceridwen.us
Fri May 2 17:07:41 EDT 2014


On May 2, 2014, at 10:37 AM, Geert Janssens <janssens-geert at telenet.be> wrote:

> On Friday 02 May 2014 13:22:38 Mike Alexander wrote:
>> On May 2, 2014, at 9:58 AM, Geert Janssens <gjanssens at code.gnucash.org> wrote:
>>> Updated	 via  https://github.com/Gnucash/gnucash/commit/ca480862
>>> (commit)> 
>>> 	from  https://github.com/Gnucash/gnucash/commit/08c59b58 (commit)
>>> 
>>> commit ca48086287045c0af08b0dde62ce121e00a8e0c0
>>> Author: Geert Janssens <janssens-geert at telenet.be>
>>> Date:   Fri May 2 15:55:48 2014 +0200
>>> 
>>>   Add _FORTIFY_SOURCE directive only when compiling with
>>>   optimization enabled
>> This change seems to add _FORTIFY_SOURCE for any level of -O,
>> including -O0.  Am I reading it correctly?  Does this work?  If so,
>> that's why I didn't see the problem.  My build script always supplies
>> a -O parameter, either -O0 or -O2 for debug or optimized builds
>> respectively.  The error message seems to imply that you need an
>> optimization level greater than 0 for _FORTIFY_SOURCE.
>> 
>>               Mike
> Uhm that shows my limited understanding of gcc options. I think you are correct that it needs 
> more than -O0 though I don't even know how to test that.
> 
> From what I understand gnucash' configure script will strip out any -Ox if --enable-debug is set. 
> Since I have this set I don't have any -Ox in CFLAGS anymore.
> 
> My gcc is 4.8.2 by the way. But I saw the same error the one time I built with clang a couple of 
> days back.

It’s not the compiler, it’s glibc, and in particular features.h. Apple uses the BSD libc, which doesn’t have a features.h. Interestingly, the version of features.h in Debian Testing just silently sets what it thinks is the right FORTIFY_SOURCE level without raising the warning that Fedora does.

I’ve just pushed a better test that tries to compile and won’t set FORTIFY_SOURCE if features.h raises a warning.

Regards,
John Ralls




More information about the gnucash-devel mailing list