Re: -D_FORTIFY_SOURCE defined but value is too low [-Werror]

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

 



On Mon, Jan 16, 2023 at 1:05 PM Daniel P. Berrangé <berrange@xxxxxxxxxx> wrote:
>
> I'm getting the strange error in $SUBJECT in an upstream CI job that
> is targetting Fedora rawhide. I'm guessing it is something related to
> the recent changes to set the  _FOTIFY_SOURCE value to 3 instead of
> 2, but not sure what.
>
> What I'm finding especially bizarre is that I can't reproduce it on
> rawhide myself, despite using the exact same package versions and
> base container.
>
> I can't even figure out which particular component is emitting this
> error message string. My only thought is that perhaps it could be
> ccache related, since upstream CI has ccache enabled and the cache
> is preserved across CI pipelines. That could explain why I can't
> reproduce myself.
>
> My app has a config.h file used by all sources that does
>
>   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
>   # define _FORTIFY_SOURCE 2
>   #endif
>
> but the -D_FORTIFY_SOURCE=3 set by RPM in CFLAGS on the gcc command
> line ought to override this fine.
>
> $ gcc -Ilibvirt-glib/libvirt-glib-1.0.so.0.4000.0.p -Ilibvirt-glib -I../libvirt-glib -I. -I.. -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 ...snip many -Wxxx flags... -fexceptions -fasynchronous-unwind-tables -fipa-pure-const  -fstack-protector-strong -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe  -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -pthread '-DLOCALEDIR="/usr/share/locale"' '-DDATADIR="/usr/share"' -DLIBVIRT_GLIB_BUILD -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_48 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_48 -MD -MQ libvirt-glib/libvirt-glib-1.0.so.0.4000.0.p/libvirt-glib-error.c.o -MF libvirt-glib/libvirt-glib-1.0.so.0.4000.0.p/libvirt-glib-error.c.o.d -o libvirt-glib/libvirt-glib-1.0.so.0.4000.0.p/libvirt-glib-error.c.o -c ../libvirt-glib/libvirt-glib-error.c
> ../libvirt-glib/libvirt-glib-error.c: error: -D_FORTIFY_SOURCE defined but value is too low [-Werror]
> cc1: all warnings being treated as errors
>
> So does anyone know what this error message would be coming from, and more
> importantly how to make it go away :-)

I've seen this happen with ccache is in use[1], which flips the
defines around, causing _FORTIFY_SOURCE to be undefined.  I've posted
a fix to redhat-rpm-config[2] to remedy this in the default flags to
work around the reordering; the additional -U was redundant anyway.

Sid

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2160275
[2] https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/237
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux