lkml.org 
[lkml]   [2020]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[perf] Explicitly use python[3]-[config]
Hi,

I wanted to have some detailed numbers for building a Linux-kernel
with GNU-eco-system means GNU/gcc-10 and GNU/binutils-2,35 VS.
LLVM/Clang with its utils version 11.0.0-rc1.

Arnd recommended me to use "perf stat make ...".

First, I tried to build it out of tools/perf from linux.git:

MAKE_OPTS="HOSTCC=clang-11 HOSTCXX=clang++-11 HOSTLD=ld.lld-11
HOSTAR=llvm-ar-11 CC=clang-11 LD=ld.lld-11 AR=llvm-ar-11 NM=llvm-nm-11
OBJCOPY=llvm-objcopy-11 OBJDUMP=llvm-objdump-11 OBJSIZE=llvm-size-11
READELF=llvm-readelf-11 STRIP=llvm-strip-11 LLVM_IAS=1"

LC_ALL=C make V=1 $MAKE_OPTS -C tools/ perf 2>&1 | tee ../build-perf.txt

That showed me - it is building against libpython2.

As python3 is now default for Debian/unstable (and AFAICS
Debian/testing) I wanted to build explicitly against libpython3 at its
python3-config.

This needs some hacks like (furthermore I do not want CID in my version-string):

$ cat ~/src/linux-kernel/perf.diff
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 513633809c81..b4da50754b19 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -225,12 +225,13 @@ endif
# python[2][-config] in weird combinations but always preferring
# python2 and python2-config as per pep-0394. If we catch a
# python[-config] in version 3, the version check will kill it.
-PYTHON2 := $(if $(call get-executable,python2),python2,python)
-override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
-PYTHON2_CONFIG := \
+# XXX: Explicitly use python3[-config]. -dileks
+PYTHON3 := $(if $(call get-executable,python3),python3,python)
+override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON3))
+PYTHON3_CONFIG := \
$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
override PYTHON_CONFIG := \
- $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
+ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON3_CONFIG))

grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 59241ff342be..eed9be9a13de 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -28,6 +28,8 @@ if test -z "$TAG"
then
TAG=$(MAKEFLAGS= make -sC ../.. kernelversion)
fi
+# XXX: Do not use Git Commit-ID (CID) in version string. -dileks
+CID=
VN="$TAG$CID"
if test -n "$CID"
then
In Debian/unstable libpython-dev:amd64 is version 2.7.17-2 and thus
ships appropriate python[2]-config.

What are your recommendations to build explicitly against python3 and
its python3-config (here: Debian ships python3 version 3.8.5)?

I can send you my build-perf.txt if needed (approx. 830kiB).

Thanks.

Regards,
- Sedat -

[1] https://github.com/ClangBuiltLinux/linux/issues/1086#issuecomment-665540053

P.S.: Uninstall all python2 dev packages and replace them via python3
dev packages.

# diff -uprN packages_0518.txt packages_0519.txt | egrep '^[+|-]ii'
-ii libpython-dev:amd64 2.7.17-2
-ii libpython2-dev:amd64 2.7.17-2
-ii libpython2.7-dev:amd64 2.7.18-1
+ii libpython3-dev:amd64 3.8.2-3
+ii libpython3.8-dev:amd64 3.8.5-1
+ii libunwind-dev:amd64 1.2.1-11
+ii libzstd-dev:amd64 1.4.5+dfsg-3
+ii lz4 1.9.2-2
-ii python-dev 2.7.17-2
-ii python2-dev 2.7.17-2
-ii python2.7-dev 2.7.18-1
+ii python3-dev 3.8.2-3
+ii python3.8-dev 3.8.5-1
+ii systemtap-sdt-dev 4.3-1
- EOT -

\
 
 \ /
  Last update: 2020-07-30 12:09    [W:0.076 / U:1.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site