Description of problem: rpmbuild uses %optflags which is: $ rpm --eval %optflags -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection Note this part: -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 The file /usr/lib/rpm/redhat/redhat-annobin-cc1 contains: *cc1_options: + %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=gcc-annobin} Note the use of -fplugin=gcc-annobin This works for GCC 11 as $ rpm -ql gcc-plugin-annobin | tail -3 /usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so /usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so.0 /usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so.0.0.0 However, for GCC 12 there are no gcc-annobin.so*: $ rpm -ql gcc-toolset-12-annobin-plugin-gcc /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin-plugin-version-info /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so.0 /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so.0.0.0 This means we can't mix default rpmbuild %optflags and GCC 12, which make usefulness of GCC 12 very small, it can't be used to build rpms. Can the gcc-annobin.so files required via rpmbuild's %optflags please be added to gcc-toolset-12?
It looks like this is essentially a dup of bug 2107575.
*** This bug has been marked as a duplicate of bug 2107575 ***