Re: [Linux-v5.17-rc6] Building tools/perf with perl v5.34

From: Sedat Dilek
Date: Sat Mar 05 2022 - 22:20:01 EST


On Sun, Mar 6, 2022 at 3:28 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>
> On Sat, Mar 5, 2022 at 9:09 PM Jiri Olsa <olsajiri@xxxxxxxxx> wrote:
> >
> > On Sat, Mar 05, 2022 at 08:52:18AM +0100, Sedat Dilek wrote:
> > > Hi,
> > >
> > > I am here on Debian/unstable AMD64 which switched over to perl v5.34
> > > in February 2022.
> > >
> > > Unfortunately, my perf does not build with this (lib)perl version:
> > >
> > > $ ~/bin/perf -vv
> > > perf version 5.17-rc6
> > > dwarf: [ on ] # HAVE_DWARF_SUPPORT
> > > dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT
> > > glibc: [ on ] # HAVE_GLIBC_SUPPORT
> > > syscall_table: [ on ] # HAVE_SYSCALL_TABLE_SUPPORT
> > > libbfd: [ on ] # HAVE_LIBBFD_SUPPORT
> > > libelf: [ on ] # HAVE_LIBELF_SUPPORT
> > > libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT
> > > numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT
> > > libperl: [ OFF ] # HAVE_LIBPERL_SUPPORT
> > > libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT
> > > libslang: [ on ] # HAVE_SLANG_SUPPORT
> > > libcrypto: [ on ] # HAVE_LIBCRYPTO_SUPPORT
> > > libunwind: [ on ] # HAVE_LIBUNWIND_SUPPORT
> > > libdw-dwarf-unwind: [ on ] # HAVE_DWARF_SUPPORT
> > > zlib: [ on ] # HAVE_ZLIB_SUPPORT
> > > lzma: [ on ] # HAVE_LZMA_SUPPORT
> > > get_cpuid: [ on ] # HAVE_AUXTRACE_SUPPORT
> > > bpf: [ on ] # HAVE_LIBBPF_SUPPORT
> > > aio: [ on ] # HAVE_AIO_SUPPORT
> > > zstd: [ on ] # HAVE_ZSTD_SUPPORT
> > > libpfm4: [ OFF ] # HAVE_LIBPFM
> > >
> > > $ grep libperl ../make-log_perf-python3.10-install_bin.txt
> > > 9:Makefile.config:788: Missing perl devel files. Disabling perl
> > > scripting support, please install perl-ExtUtils-Embed/libperl-dev
> > > 22:... libperl: [ OFF ]
> > >
> > > Checking for these requirements:
> > >
> > > # dpkg -l | grep perl | grep 5.34 | awk '/^ii/ {print $1 " " $2 " "
> > > $3}' | column -t
> > > ii libperl-dev:amd64 5.34.0-3
> > > ii libperl5.34:amd64 5.34.0-3
> > > ii perl 5.34.0-3
> > > ii perl-base 5.34.0-3
> > > ii perl-modules-5.34 5.34.0-3
> > >
> > > # dpkg -L perl-modules-5.34 | grep -i ExtUtils | grep -i Embed
> > > /usr/share/perl/5.34.0/ExtUtils/Embed.pm
> > >
> > > Can you please comment on this?
> >
> > hi,
> > is there something in tools/build/feature/test-libperl.make.output ?
> >
>
> Hey jirka!
>
> Indeed there is such a file.
>
> $ LC_ALL=C ll tools/build/feature/test-libperl.make.output
> -rw-r--r-- 1 dileks dileks 24K Mar 6 03:22
> tools/build/feature/test-libperl.make.output
>
> Reproducer:
>
> make distclean
> make -C tools/perf clean
>
> MAKE="make"
> MAKE_OPTS="HOSTCC=clang-13 HOSTCXX=clang++-13 HOSTLD=ld.lld-13
> HOSTAR=llvm-ar-13 CC=clang-13 LD=ld.lld-13 AR=llvm-ar-13 NM=llvm-nm-13
> OBJCOPY=llvm-objcopy-13 OBJDUMP=llvm-objdump-13 OBJSIZE=llvm-size-13
> READELF=llvm-readelf-13 STRIP=llvm-strip-13 LLVM_IAS=1"
>
> LC_ALL=C $MAKE V=1 $MAKE_OPTS -C tools/perf PYTHON=python3 install-bin
>
> - Sedat -

With this diff:

$ git diff
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1480910c792e..ef9b37c5c652 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -81,7 +81,7 @@ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config

all: $(FILES)

-__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst
%.bin,%.c,$(@F)) $(LDFLAGS)
+__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror
-Wno-compound-token-split-by-macro -o $@ $(patsubst %.bin,%.c,$(@F))
$(LDFLAGS)
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1

__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst
%.bin,%.cpp,$(@F)) $(LDFLAGS)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 913bf509bd17..c3e5bcf5264a 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -213,7 +213,7 @@ endif

# Treat warnings as errors unless directed not to
ifneq ($(WERROR),0)
- CORE_CFLAGS += -Werror
+ CORE_CFLAGS += -Werror -Wno-compound-token-split-by-macro
CXXFLAGS += -Werror
HOSTCFLAGS += -Werror
endif

I am able to build with libperl support:

$ ~/bin/perf -vv
perf version 5.17-rc6
dwarf: [ on ] # HAVE_DWARF_SUPPORT
dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT
glibc: [ on ] # HAVE_GLIBC_SUPPORT
syscall_table: [ on ] # HAVE_SYSCALL_TABLE_SUPPORT
libbfd: [ on ] # HAVE_LIBBFD_SUPPORT
libelf: [ on ] # HAVE_LIBELF_SUPPORT
libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT
libperl: [ on ] # HAVE_LIBPERL_SUPPORT
libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT
libslang: [ on ] # HAVE_SLANG_SUPPORT
libcrypto: [ on ] # HAVE_LIBCRYPTO_SUPPORT
libunwind: [ on ] # HAVE_LIBUNWIND_SUPPORT
libdw-dwarf-unwind: [ on ] # HAVE_DWARF_SUPPORT
zlib: [ on ] # HAVE_ZLIB_SUPPORT
lzma: [ on ] # HAVE_LZMA_SUPPORT
get_cpuid: [ on ] # HAVE_AUXTRACE_SUPPORT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
aio: [ on ] # HAVE_AIO_SUPPORT
zstd: [ on ] # HAVE_ZSTD_SUPPORT
libpfm4: [ OFF ] # HAVE_LIBPFM

Dunno if I need "-Werror -Wno-compound-token-split-by-macro" for any
HOSTCXX/CXX flags.

- Sedat -