Re: [Linux-v5.17-rc6] Building tools/perf with perl v5.34
From: Sedat Dilek
Date: Sat Mar 05 2022 - 03:26:57 EST
On Sat, Mar 5, 2022 at 8:57 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>
> On Sat, Mar 5, 2022 at 8:52 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> 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?
> >
> > Thanks.
> >
> > Regards,
> > - Sedat -
> >
> > [1] https://unix.stackexchange.com/questions/167292/what-is-debian-equivalent-of-rpm-package-perl-extutils-embed
>
> My command-line:
>
> cd /path/to/linux.git
>
> $ make V=1 -j4 HOSTCC=clang HOSTCXX=clang++ HOSTLD=ld.lld
> HOSTAR=llvm-ar CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm
> OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size
> READELF=llvm-readelf STRIP=llvm-strip LLVM_IAS=1 -C tools/perf
> PYTHON=python3.10 install-bin
>
> I use the -gnu-std-11 patchset plus some own:
>
> $ git log --oneline v5.17-rc6.. | grep 'std=gnu11'
> 05d8e9b88918 tools: libtraceevent: Use -std=gnu11
> ee44279e6b01 tools: libsubcmd: Use -std=gnu11
> 411fa2d6da5c tools: libapi: Use -std=gnu11
> 3f0092b7e1b9 tools: perf: Use -std=gnu11
> 0cf56ddf2b41 tools: libbpf: Use -std=gnu11
> 96a4222bdd4c Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS
> 6a7cc105b238 Kbuild: move to -std=gnu11
>
> If this matters...
>
[ tools/perf/Makefile.config ]
ifdef NO_LIBPERL
CFLAGS += -DNO_LIBPERL
else
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects,
$(PERL_EMBED_CCOPTS))
PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
ifneq ($(feature-libperl), 1)
CFLAGS += -DNO_LIBPERL
NO_LIBPERL := 1
msg := $(warning Missing perl devel files. Disabling perl
scripting support, please install perl-ExtUtils-Embed/libperl-dev);
else
LDFLAGS += $(PERL_EMBED_LDFLAGS)
EXTLIBS += $(PERL_EMBED_LIBADD)
CFLAGS += -DHAVE_LIBPERL_SUPPORT
$(call detected,CONFIG_LIBPERL)
endif
endif
$ perl -MExtUtils::Embed -e ldopts
-Wl,-E -fstack-protector-strong -L/usr/local/lib
-L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread
-lc -lcrypt
$ perl -MExtUtils::Embed -e ccopts
-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/lib/x86_64-linux-gnu/perl/5.34/CORE
- Sedat -