Description of problem: build_cflags is defined as: build_cflags %{optflags} %{?_distro_extra_cflags} suggesting that extra flags can be added by defining _distro_extra_cflags. However, doing %global _distro_extra_cflags -Wno-error=stringop-overflow has no effect on build_cflags unless I disable _auto_set_build_flags using %undefine _auto_set_build_flags and add %set_build_flags to %build manually. Version-Release number of selected component (if applicable): redhat-rpm-config-254-1.fc39.noarch How reproducible: Always. Steps to Reproduce: 1. Add %global _distro_extra_cflags -Wno-error=stringop-overflow to your spec file 2. rpmbuild -bc foo.spec Actual results: ... + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-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' ... Expected results: ... + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-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 -Wno-error=stringop-overflow' ...
Additional info: rpm -D '_distro_extra_cflags -Wall' -E '%build_cflags' | grep -e '\-Wall$' does work. Doing the same in a spec file doesn't.
(In reply to Dominik 'Rathann' Mierzejewski from comment #0) > Steps to Reproduce: > 1. Add %global _distro_extra_cflags -Wno-error=stringop-overflow to your > spec file If that doesn't work, this is actually a good thing. %_distro_extra_cflags must not be changed in individual spec files, it's reserved for use by the distribution. That being said, I cannot reproduce this issue.
(In reply to Florian Weimer from comment #2) > (In reply to Dominik 'Rathann' Mierzejewski from comment #0) > > Steps to Reproduce: > > 1. Add %global _distro_extra_cflags -Wno-error=stringop-overflow to your > > spec file > > If that doesn't work, this is actually a good thing. %_distro_extra_cflags > must not be changed in individual spec files, it's reserved for use by the > distribution. Well, _distro_extra_cflags is undefined at the moment, so I thought it'd be ok to use. What is the "official" way of adding some extra CFLAGS, then? > That being said, I cannot reproduce this issue. Odd. It's 100% reproducible in rawhide mock for me.
(In reply to Dominik 'Rathann' Mierzejewski from comment #3) > (In reply to Florian Weimer from comment #2) > > (In reply to Dominik 'Rathann' Mierzejewski from comment #0) > > > Steps to Reproduce: > > > 1. Add %global _distro_extra_cflags -Wno-error=stringop-overflow to your > > > spec file > > > > If that doesn't work, this is actually a good thing. %_distro_extra_cflags > > must not be changed in individual spec files, it's reserved for use by the > > distribution. > > Well, _distro_extra_cflags is undefined at the moment, so I thought it'd be > ok to use. > > What is the "official" way of adding some extra CFLAGS, then? Do it at the shell level (CFLAGS="$CFLAGS -Wno-error=stringop-overflow"), I think. > > That being said, I cannot reproduce this issue. > > Odd. It's 100% reproducible in rawhide mock for me. I tried with the lua spec file and it worked for me. So we'd need to see your spec file.