From 22833c108450422da85d6a9bfcc5f5facb902858 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 20 May 2022 14:25:10 +0800 Subject: [PATCH] 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) --- ceph.spec.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ceph.spec.in b/ceph.spec.in index cfd993cfa1317..096fda2574210 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -120,6 +120,13 @@ # disable dwz which compresses the debuginfo %global _find_debuginfo_dwz_opts %{nil} +%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 ################################################################################# -- 2.39.5