compiles fine with -perl Installed versions: 6.11.7-r1{gpkg:5}(07:14:23 2025-03-11)(babeltrace bpf caps capstone crypt doc gtk java libpfm libtraceevent libtracefs lzma python tcmalloc zstd -audit -big-endian -debug -numa -perl -slang -systemtap -unwind ABI_MIPS="-n32 -n64 -o32" LLVM_SLOT="19 -16 -17 -18" PYTHON_TARGETS="python3_12 -python3_10 -python3_11 -python3_13") with USE="perl" added, emerge fails dev-util/perf-6.11.7-r1::gentoo USE="babeltrace bpf caps capstone crypt doc gtk java libpfm libtraceevent libtracefs lzma perl* python tcmalloc zstd -audit (-big-endian) -debug -numa -slang -systemtap -unwind" LLVM_SLOT="19 -16 -17 -18" PYTHON_TARGETS="python3_12 -python3_10 -python3_11 -python3_13" 0 KiB /var/tmp/portage/dev-util/perf-6.11.7-r1/work/linux-6.11/tools/perf/pmu-events/pmu-events.c:72851:(.text+0xb79): undefined reference to `strcmp_cpuid_str' collect2: error: ld returned 1 exit status make[1]: *** [Makefile.perf:793: perf] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/var/tmp/portage/dev-util/perf-6.11.7-r1/work/linux-6.11/tools/perf' make: *** [Makefile.perf:290: sub-make] Error 2 * ERROR: dev-util/perf-6.11.7-r1::gentoo failed (compile phase): * emake failed *
Created attachment 920557 [details] emerge --info dev-util/perf
Created attachment 920559 [details] /var/tmp/portage/dev-util/perf-6.11.7-r1/temp/build.log
Note: System is compiled with lto Have not tried without lto on system level. dev-util/perf behaves the same as presented here with or without lto on ebuild level.
Same results if unmasking dev-util/perf and emerging dev-util/perf-6.13.5
This is interesting since it's part of autogenerated stuff and the function is declared as weak, see: https://github.com/torvalds/linux/blob/master/tools/perf/util/header.c#L847
(In reply to Holger Hoffstätte from comment #5) > This is interesting since it's part of autogenerated stuff and the function > is declared as weak, see: > https://github.com/torvalds/linux/blob/master/tools/perf/util/header.c#L847 ..which apparently has nothing to do with the problem. Also: - the ebuild does filter-lto - I can build perf-6.13.5 with USE=perl just fine
Inspecting the build.log shows that perf itself is built without LTO (as -flto is filtered out) but apparently that's NOT the case for the perl integration, where -flto shows up twice.
*** Bug 946997 has been marked as a duplicate of this bug. ***
I can build with perl if i disable all other use-flags. Traversing through a number of compiles now. Will report back in 30 min.
It uses the flags Perl was built with (https://github.com/torvalds/linux/blob/master/tools/perf/Makefile.config#L821) and poorly filters out LTO there (only -flto=auto).
[-libtraceevent] makes dev-util/perf compile with [perl] enabled
(In reply to Andreas Nyback from comment #11) > [-libtraceevent] makes dev-util/perf compile with [perl] enabled Nope :) I just built perl with LTO: $perl -MExtUtils::Embed -e ccopts -pipe -march=znver2 -O2 -flto=8 -fuse-linker-plugin -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib64/perl5/5.40/x86_64-linux/CORE and building perf with both LTO (same env) and USE=libtraceevent builds & installs fine. Maybe the problem is libtraceevent being built with LTO?
(In reply to Holger Hoffstätte from comment #12) > Maybe the problem is libtraceevent being built with LTO? Nope, cannot reproduce.
Andreas: if you can still reproduce, try to get a broken combination and then attempt to change the -flto=auto in the following line: https://github.com/torvalds/linux/blob/4d872d51bc9d7b899c1f61534e3dbde72613f627/tools/perf/Makefile.config#L823 to -flto% via sed or manually & re-run make. Then -flto should no longer show up i nthe perl module build.
(In reply to Holger Hoffstätte from comment #14) > Andreas: if you can still reproduce, try to get a broken combination and > then attempt to change the -flto=auto in the following line: > > https://github.com/torvalds/linux/blob/ > 4d872d51bc9d7b899c1f61534e3dbde72613f627/tools/perf/Makefile.config#L823 > > to -flto% via sed or manually & re-run make. Then -flto should no longer > show up i nthe perl module build. Disabling lto on dev-libs/traceevent made no difference. Building dev-lang/perl with lto disabled makes dev-util/perf build fine with [perl] and [traceevents] (dev-libs/traceevent built with lto). Will test your suggestion above
(In reply to Holger Hoffstätte from comment #14) > Andreas: if you can still reproduce, try to get a broken combination and > then attempt to change the -flto=auto in the following line: > > https://github.com/torvalds/linux/blob/ > 4d872d51bc9d7b899c1f61534e3dbde72613f627/tools/perf/Makefile.config#L823 > > to -flto% via sed or manually & re-run make. Then -flto should no longer > show up i nthe perl module build. The Makefile.config from linus is not compatible with dev-util/perf-6.11.7-r1, i get other compile errors with missing header files. Editing the ebuild provided MAkefile.config in the same manner on line 864 looks to fix the problem. I can compile dev-utils/perf-6.11.7-r1 with lto enabled in dev-lang/perl
(And with all previous use-flags enabled, including [perl] )
(In reply to Andreas Nyback from comment #16) > (In reply to Holger Hoffstätte from comment #14) > > Andreas: if you can still reproduce, try to get a broken combination and > > then attempt to change the -flto=auto in the following line: > > > > https://github.com/torvalds/linux/blob/ > > 4d872d51bc9d7b899c1f61534e3dbde72613f627/tools/perf/Makefile.config#L823 > > > > to -flto% via sed or manually & re-run make. Then -flto should no longer > > show up i nthe perl module build. > > The Makefile.config from linus is not compatible with > dev-util/perf-6.11.7-r1, i get other compile errors with missing header > files. > > Editing the ebuild provided MAkefile.config in the same manner on line 864 > looks to fix the problem. I can compile dev-utils/perf-6.11.7-r1 with lto > enabled in dev-lang/perl \o/ Now all you need to do :-) is: - check out linux git (protip: make it shallow) - commit the fix with proper Signed-off-by: - run scripts/get_maintainer.pl -f tools/perf - configure git-send-email (see https://git-send-email.io/) and send your patch to the mentioned addresses You too can be a kernel contributor!
(In reply to Holger Hoffstätte from comment #18) > (In reply to Andreas Nyback from comment #16) > > (In reply to Holger Hoffstätte from comment #14) > > > Andreas: if you can still reproduce, try to get a broken combination and > > > then attempt to change the -flto=auto in the following line: > > > > > > https://github.com/torvalds/linux/blob/ > > > 4d872d51bc9d7b899c1f61534e3dbde72613f627/tools/perf/Makefile.config#L823 > > > > > > to -flto% via sed or manually & re-run make. Then -flto should no longer > > > show up i nthe perl module build. > > > > The Makefile.config from linus is not compatible with > > dev-util/perf-6.11.7-r1, i get other compile errors with missing header > > files. > > > > Editing the ebuild provided MAkefile.config in the same manner on line 864 > > looks to fix the problem. I can compile dev-utils/perf-6.11.7-r1 with lto > > enabled in dev-lang/perl > > \o/ > > Now all you need to do :-) is: > > - check out linux git (protip: make it shallow) > - commit the fix with proper Signed-off-by: > - run scripts/get_maintainer.pl -f tools/perf > - configure git-send-email (see https://git-send-email.io/) and send your > patch to the mentioned addresses > > You too can be a kernel contributor! Haha I will ask my son. He would love that Though the fix is more yours to own :-)
(In reply to Andreas Nyback from comment #19) > I will ask my son. He would love that > Though the fix is more yours to own :-) In that case I will try and send it upstream in the next few days. Maybe one of our cc'ed committers can add an intermediate fix - a simple sed -i "s/filter-out -flto=auto/filter-out -flto%/g" tools/perf/Makefile.config looks like it will do the trick for now.
When you submit a patch to fix this upstream, please add me in CC. Thank you.
Sent upstream: https://lore.kernel.org/linux-perf-users/fa1c3b38-6a23-af22-0e5e-280fa523d06a@applied-asynchrony.com/