From: Kefu Chai Date: Fri, 20 May 2022 06:25:10 +0000 (+0800) Subject: ceph.spec.in: disable annobin plugin if compile with gcc-toolset X-Git-Tag: v17.2.1~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8bae27e49f9ace3a8cc9e76dcfe28ea68dea1ddc;p=ceph.git ceph.spec.in: disable annobin plugin if compile with gcc-toolset we are seeing FTBFS failures when compiling the packages with seastar enabled, like: Package gcc-toolset-9-annobin-9.08-4.el8.x86_64 is already installed. ... Package redhat-rpm-config-130-1.el8.noarch is already installed. ... CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection ... -- The CXX compiler identification is GNU 9.2.1 .... Building CXX object CMakeFiles/cmTC_386fb.dir/testCXXCompiler.cxx.o /opt/rh/gcc-toolset-9/root/usr/bin/c++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -o CMakeFiles/cmTC_386fb.dir/testCXXCompiler.cxx.o -c /home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/17.2.0-209-g3e01cd41/rpm/el8/BUILD/ceph-17.2.0-209-g3e01cd41/x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp/testCXXCompiler.cxx cc1plus: fatal error: inaccessible plugin file /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/plugin/gcc-annobin.so expanded from short plugin name gcc-annobin: No such file or directory the root cause is that redhat-rpm-config expects gcc-annobin: $ cat /usr/lib/rpm/redhat/redhat-annobin-cc1 *cc1_options: + %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=gcc-annobin} while this plugin is not installed by gcc-toolset-9-annobin, which installs annobin.so though: $ rpm -ql gcc-toolset-9-annobin| grep annobin.so /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/plugin/annobin.so /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/plugin/annobin.so.0 /opt/rh/gcc-toolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/plugin/annobin.so.0.0.0 but gcc-toolset-8-annobin provides this file. upgrading to gcc-toolset-11 does not help. see https://centos.pkgs.org/8-stream/centos-appstream-x86_64/gcc-toolset-11-annobin-plugin-gcc-10.23-1.el8.x86_64.rpm.html so, the intermediate solution would be to disable the plugin, if we want to use gcc-toolset to build rpm packages. in this change, _annotated_build is undefined to prevent the compiler from adding extra information to the binary. in general this change shuold be safe, without these information, it'd be hard to tell if the binary is hardened or what ABI version it expects. see also https://fedoraproject.org/wiki/Changes/Annobin Signed-off-by: Kefu Chai (cherry picked from commit 5a78fe176419e097c61e6596dafc39477d652280) --- diff --git a/ceph.spec.in b/ceph.spec.in index a9f742669f52..e88229f90074 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -145,6 +145,13 @@ %endif %endif +%if 0%{with seastar} +# disable -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1, as gcc-toolset-{9,10}-annobin +# do not provide gcc-annobin.so anymore, despite that they provide annobin.so. but +# redhat-rpm-config still passes -fplugin=gcc-annobin to the compiler. +%undefine _annotated_build +%endif + ################################################################################# # main package definition #################################################################################