Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 951151 - dev-util/perf-6.11.7-r1[perl] fails to compile
Summary: dev-util/perf-6.11.7-r1[perl] fails to compile
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Guilherme Amadio
URL:
Whiteboard:
Keywords:
: 946997 (view as bug list)
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2025-03-11 06:59 UTC by Andreas Nyback
Modified: 2025-03-11 17:50 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info dev-util/perf (emerge_info,36.38 KB, text/plain)
2025-03-11 07:06 UTC, Andreas Nyback
Details
/var/tmp/portage/dev-util/perf-6.11.7-r1/temp/build.log (build.log.gz,137.34 KB, text/plain)
2025-03-11 07:11 UTC, Andreas Nyback
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Nyback 2025-03-11 06:59:16 UTC
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
 *
Comment 1 Andreas Nyback 2025-03-11 07:06:12 UTC
Created attachment 920557 [details]
emerge --info dev-util/perf
Comment 2 Andreas Nyback 2025-03-11 07:11:04 UTC
Created attachment 920559 [details]
/var/tmp/portage/dev-util/perf-6.11.7-r1/temp/build.log
Comment 3 Andreas Nyback 2025-03-11 07:13:20 UTC
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.
Comment 4 Andreas Nyback 2025-03-11 07:16:40 UTC
Same results if unmasking dev-util/perf and emerging dev-util/perf-6.13.5
Comment 5 Holger Hoffstätte 2025-03-11 10:27:48 UTC
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
Comment 6 Holger Hoffstätte 2025-03-11 10:41:08 UTC
(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
Comment 7 Holger Hoffstätte 2025-03-11 10:51:49 UTC
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.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 11:00:12 UTC
*** Bug 946997 has been marked as a duplicate of this bug. ***
Comment 9 Andreas Nyback 2025-03-11 11:02:47 UTC
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.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 11:04:30 UTC
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).
Comment 11 Andreas Nyback 2025-03-11 11:12:29 UTC
[-libtraceevent] makes dev-util/perf compile with [perl] enabled
Comment 12 Holger Hoffstätte 2025-03-11 11:20:45 UTC
(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?
Comment 13 Holger Hoffstätte 2025-03-11 11:23:36 UTC
(In reply to Holger Hoffstätte from comment #12)
> Maybe the problem is libtraceevent being built with LTO?

Nope, cannot reproduce.
Comment 14 Holger Hoffstätte 2025-03-11 11:30:59 UTC
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.
Comment 15 Andreas Nyback 2025-03-11 11:41:59 UTC
(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
Comment 16 Andreas Nyback 2025-03-11 12:08:44 UTC
(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
Comment 17 Andreas Nyback 2025-03-11 12:09:45 UTC
(And with all previous use-flags enabled, including [perl] )
Comment 18 Holger Hoffstätte 2025-03-11 12:29:56 UTC
(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!
Comment 19 Andreas Nyback 2025-03-11 12:34:05 UTC
(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 :-)
Comment 20 Holger Hoffstätte 2025-03-11 12:56:06 UTC
(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.
Comment 21 Guilherme Amadio gentoo-dev 2025-03-11 17:03:25 UTC
When you submit a patch to fix this upstream, please add me in CC. Thank you.