All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	Kate Carcia <kcarcia@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Adrian Hunter <adrian.hunter@intel.com>,
	Dmitrii Dolgov <9erthalion6@gmail.com>,
	Ian Rogers <irogers@google.com>,
	James Clark <james.clark@arm.com>,
	Kang Minchul <tegongkang@gmail.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Kautuk Consul <kconsul@ventanamicro.com>,
	Leo Yan <leo.yan@linaro.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Nikita Shubin <n.shubin@yadro.com>,
	Yang Jihong <yangjihong1@huawei.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [GIT PULL] perf tools changes for v6.2: 1st batch
Date: Sat, 17 Dec 2022 11:50:07 -0300	[thread overview]
Message-ID: <Y53XHw3rlsaaUgOs@kernel.org> (raw)
In-Reply-To: <CAHk-=wj+FNSnspKwVWAatD+DHz3Uy4eHxQryrfoZz6=4D=1X1w@mail.gmail.com>

Em Fri, Dec 16, 2022 at 01:41:24PM -0600, Linus Torvalds escreveu:
> On Fri, Dec 16, 2022 at 8:36 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> >         This time there is a trivial resolution of a merge conflict
> > related to commit c302378bc157f6a7 ("libbpf: Hashmap interface update to
> > allow both long and void* keys/values"), that touched tools/perf/ files.
 
> Normally I'd ask you very sternly to please not resolve merge
> conflicts for me, but since I just screwed up another merge due to

I thought I was helping you... Now I know better :-/

> being on the road and not having done a full build test, I guess I
> will just be quiet this time.
 
> So the real reason for this email is that I get an error like this on
> my laptop when trying to build the perf tools:
 
>     INSTALL libbpf_headers
>   Traceback (most recent call last):
>     File "util/setup.py", line 31, in <module>
>       from setuptools import setup, Extension
>   ImportError: No module named setuptools
>   cp: cannot stat 'python_ext_build/lib/perf*.so': No such file or directory
>   make[2]: *** [Makefile.perf:651: python/perf] Error 1
>   make[2]: *** Waiting for unfinished jobs....
>   make[1]: *** [Makefile.perf:236: sub-make] Error 2
>   make: *** [Makefile:70: all] Error 2
 
> and it's not new to this pull - I've seen it before and it's something
> stupid I've done.
 
> I think it's a missing package dependency that this laptop then hits.
> But considering my previous merge failure, I'm not super-happy about
> traveling with a laptop that then can't do this build test.

My bad, I should have acted upon that immediately, oh well, fell thru
the cracks but now I have a fix in my perf/core and perf/urgent
branches.

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/urgent

It will be in my next pull req if you prefer not to apply it unsigned or
manually from the copy below.
 
> It would be lovely to have that package dependency - whatever it may
> be - tested for explicitly. Hint hint.

And below you have it, now back to the pool, the kids are waiting :-)

Regards,

- Arnaldo

From 71c2c68e4fadc9019d727bdcf54490c438d59cdb Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Sat, 17 Dec 2022 11:37:15 -0300
Subject: [PATCH 1/1] perf python: Don't stop building if python setuptools
 isn't installed

The python3-setuptools package is needed to build the python binding, so
that one can use things like:

  # ~acme/git/perf/tools/perf/python/twatch.py
  cpu: 6, pid: 4573, tid: 2184618 { type: exit, pid: 4573, ppid: 4172, tid: 2184618, ptid: 4172, time: 12563190090107}
  cpu: 24, pid: 4573, tid: 4573 { type: fork, pid: 4573, ppid: 4573, tid: 2190991, ptid: 4573, time: 12563415289331}
  cpu: 29, pid: 4573, tid: 2190991 { type: comm, pid: 4573, tid: 2190991, comm: StreamT~ns #401 }
  cpu: 29, pid: 4573, tid: 2190991 { type: comm, pid: 4573, tid: 2190991, comm: StreamT~ns #401 }
  ^CTraceback (most recent call last):
    File "/var/home/acme/git/perf/tools/perf/python/twatch.py", line 61, in <module>
      main()
    File "/var/home/acme/git/perf/tools/perf/python/twatch.py", line 33, in main
      evlist.poll(timeout = -1)
  KeyboardInterrupt

  #

That have 'import perf;'.

But distros don't always have that python3-setuptools (or equivalent)
installed, which was breaking the build. Just check if it is installed
and emit a warning that such binding isn't being built and continue the
build without it:

With it:

  $ rpm -q python3-setuptools
  python3-setuptools-59.6.0-3.fc36.noarch
  $ rm -rf /tmp/build/perf; mkdir -p /tmp/build/perf
  $ make O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/var/home/acme/git/perf/tools/perf'
  <SNIP>
  ...                               libpython: [ on  ]
  <SNIP>
    GEN     /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so
  <SNIP>
  $ ls -la /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so
  -rwxr-xr-x. 1 acme acme 1609112 Dec 17 11:39 /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so
  $

Without it:

  $ sudo rpm -e python3-setuptools
  $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
  $ make O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/var/home/acme/git/perf/tools/perf'
  <SNIP>
  ...                               libpython: [ on  ]
  <SNIP>
  $ ls -la /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so
  ls: cannot access '/tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so': No such file or directory
  $

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.config | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 83ed969b95b4a53f..c21bd6010be1384c 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -890,8 +890,13 @@ else
       else
          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
          EXTLIBS += $(PYTHON_EMBED_LIBADD)
-         PYTHON_EXTENSION_SUFFIX := $(shell $(PYTHON) -c 'from importlib import machinery; print(machinery.EXTENSION_SUFFIXES[0])')
-         LANG_BINDINGS += $(obj-perf)python/perf$(PYTHON_EXTENSION_SUFFIX)
+         PYTHON_SETUPTOOLS_INSTALLED := $(shell $(PYTHON) -c 'import setuptools;' 2> /dev/null && echo "yes" || echo "no")
+         ifeq ($(PYTHON_SETUPTOOLS_INSTALLED), yes)
+           PYTHON_EXTENSION_SUFFIX := $(shell $(PYTHON) -c 'from importlib import machinery; print(machinery.EXTENSION_SUFFIXES[0])')
+           LANG_BINDINGS += $(obj-perf)python/perf$(PYTHON_EXTENSION_SUFFIX)
+	 else
+           msg := $(warning Missing python setuptools, the python binding won't be built, please install python3-setuptools or equivalent);
+         endif
          CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
          $(call detected,CONFIG_LIBPYTHON)
       endif
-- 
2.38.1


  reply	other threads:[~2022-12-17 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 14:36 [GIT PULL] perf tools changes for v6.2: 1st batch Arnaldo Carvalho de Melo
2022-12-16 19:41 ` Linus Torvalds
2022-12-17 14:50   ` Arnaldo Carvalho de Melo [this message]
2022-12-17 16:05     ` Steven Rostedt
2022-12-17 19:55     ` Linus Torvalds
2022-12-17 20:37       ` Arnaldo Carvalho de Melo
2022-12-20 13:08       ` Arnaldo Carvalho de Melo
2022-12-16 19:44 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y53XHw3rlsaaUgOs@kernel.org \
    --to=acme@kernel.org \
    --cc=9erthalion6@gmail.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrii@kernel.org \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kcarcia@redhat.com \
    --cc=kconsul@ventanamicro.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=n.shubin@yadro.com \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tegongkang@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=williams@redhat.com \
    --cc=yangjihong1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.