lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y6GzshPKxK2Oiqjg@kernel.org>
Date:   Tue, 20 Dec 2022 10:08:02 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Ian Rogers <irogers@...gle.com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Clark Williams <williams@...hat.com>,
        Kate Carcia <kcarcia@...hat.com>, linux-kernel@...r.kernel.org,
        linux-perf-users@...r.kernel.org,
        Adrian Hunter <adrian.hunter@...el.com>,
        Dmitrii Dolgov <9erthalion6@...il.com>,
        James Clark <james.clark@....com>,
        Kang Minchul <tegongkang@...il.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Kautuk Consul <kconsul@...tanamicro.com>,
        Leo Yan <leo.yan@...aro.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Nikita Shubin <n.shubin@...ro.com>,
        Yang Jihong <yangjihong1@...wei.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [GIT PULL] perf tools changes for v6.2: 1st batch

tldr;: if you do:

$ make -C tools clean
$ sudo dnf remove python2 python2-devel
$ sudo dnf install python-devel

It should build cleanly, below I looked at the various places these
feature detections are made and found places for improving messages,
etc.

Ian, that "jevent generation" gets confused when python2 _and_ python3
is installed, please take a look at that.

- Arnaldo

Em Sat, Dec 17, 2022 at 01:55:25PM -0600, Linus Torvalds escreveu:
> On Sat, Dec 17, 2022 at 8:50 AM Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
> > The python3-setuptools package is needed to build the python binding, so
> > that one can use things like:
> 
> So this fixes the error, but there's some other reason for it.
> 
> I have
> 
>   Package python3-setuptools-59.6.0-3.fc36.noarch is already installed.
> 
> and with that patch the 'perf' build now works for me, but it says:
> 
>     Makefile.config:898: Missing python setuptools, the python binding
> won't be built, please install python3-setuptools or equivalent
> 
> and then (pre-existing)
> 
>     Makefile.config:921: Python interpreter too old (older than 3.6)
> disabling jevent generation
> 
> but I have
> 
>     python3-3.10.8-3.fc36.x86_64
> 
> Now, for some reason I *also* have python2 installed, but that one is
> called "python2".

> [ Me trying to figure things out ]
> 
> Ok, so if I uninstall my old python2 install, I now get
> 
>   Makefile.config:880: No python interpreter was found: disables
> Python support - please install python-devel/python-dev

>   Makefile.config:915: No python interpreter disabling jevent generation
> 
> ok, so I didn't have 'python3-devel' installed. Installing that fixes
> some things, but then I get
> 
>   Makefile.config:889: No 'Python.h' (for Python 2.x support) was
> found: disables Python support - please install
> python-devel/python-dev

Humm, I couldn't reproduce this one, as I have:

⬢[acme@...lbox perf]$ grep libpython /tmp/build/perf/FEATURE-DUMP
feature-libpython=1
⬢[acme@...lbox perf]$

And that message only happens when that feature-libpython != 1

That is set by this feature query snippet:

⬢[acme@...lbox perf]$ cat tools/build/feature/test-libpython.c
// SPDX-License-Identifier: GPL-2.0
#include <Python.h>

int main(void)
{
	Py_Initialize();

	return 0;
}
#undef _GNU_SOURCE
⬢[acme@...lbox perf]$

One can see the output of building it at (if you build it without O=,
please look at tools/build/feature/test-libpython.make.output instead):
):

⬢[acme@...lbox perf]$ cat /tmp/build/perf/feature/test-libpython.make.output
⬢[acme@...lbox perf]$

In my case, it is working, so empty make.output file and the test binary
works and links with python3 (tools/build/feature/test-libpython.bin
when building without O=):

⬢[acme@...lbox perf]$ file /tmp/build/perf/feature/test-libpython.bin
/tmp/build/perf/feature/test-libpython.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=601e3a065cc8e045e7a46199234c0bbf80707981, for GNU/Linux 3.2.0, not stripped
⬢[acme@...lbox perf]$ ldd /tmp/build/perf/feature/test-libpython.bin
	linux-vdso.so.1 (0x00007ffc371fe000)
	libpython3.10.so.1.0 => /lib64/libpython3.10.so.1.0 (0x00007fddb0200000)
	libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007fddb05f9000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fddb0122000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fddafe00000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fddb063f000)
⬢[acme@...lbox perf]$

The needed file is available and is part of the python3-devel file:

⬢[acme@...lbox perf]$ ls -la /usr/include/python3.10/Python.h
-rw-r--r--. 1 root root 3224 Oct 11 08:21 /usr/include/python3.10/Python.h
⬢[acme@...lbox perf]$ rpm -qf /usr/include/python3.10/Python.h
python3-devel-3.10.8-3.fc36.x86_64
⬢[acme@...lbox perf]$

That message needs updating, its from a long time ago:

9734163b6ee1425c6 tools/perf/config/Makefile (Ingo Molnar 2013-09-30 15:18:37 +0200  888)       ifneq ($(feature-libpython), 1)
6c5aa23704e2786eb tools/perf/config/Makefile (Ingo Molnar 2015-02-28 09:33:45 +0100  889)         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
6e533cf12de06368a tools/perf/config/Makefile (Jiri Olsa   2013-03-18 00:35:32 +0100  890)       else

> so apparently perf really wants *both* python2 and python3 installed.
> Isn't that a bit excessive?

I'll update that message, its one or the other, and we will work to make
it support only python3 as python2 is deprecated.
 
> Anyway, it's clearly something about the install on this laptop, but
> the error messages and the "this package is missing" things are
> clearly not entirely right.

Right, perhaps a 'make -C tools clean' may clean some previous feature
detection that stuck somehow? I'll do continue tinkering here to see if
I get this in a better shape.
 
> Whatever. It does build cleanly now for me, and I'll ignore that "No
> 'Python.h' (for Python 2.x support)" thing.

The only time I got this message was now that I uninstalled
python3-devel:

Makefile.config:889: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev

The next one I got because I have python2 installed:

⬢[acme@...lbox perf]$ rpm -qa | grep python2
python2.7-2.7.18-22.fc36.x86_64

Makefile.config:921: Python interpreter too old (older than 3.6) disabling jevent generation

Removing python2 I get:

Makefile.config:880: No python interpreter was found: disables Python support - please install python-devel/python-dev
Makefile.config:915: No python interpreter disabling jevent generation

So you get this message:

>   Makefile.config:889: No 'Python.h' (for Python 2.x support) was
> found: disables Python support - please install
> python-devel/python-dev

When you have python2 and python3 but no python3-devel nor
python2-devel:

⬢[acme@...lbox perf]$ rpm -q python3
python3-3.10.8-3.fc36.x86_64
⬢[acme@...lbox perf]$ rpm -qa | grep python2
python2.7-2.7.18-22.fc36.x86_64
⬢[acme@...lbox perf]$ rpm -q python2-devel
package python2-devel is not installed
⬢[acme@...lbox perf]$ rpm -q python3-devel
package python3-devel is not installed
⬢[acme@...lbox perf]$ m
make: Entering directory '/var/home/acme/git/perf/tools/perf'
  BUILD:   Doing 'make -j32' parallel build
<SNIP>
Makefile.config:889: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev
Makefile.config:921: Python interpreter too old (older than 3.6) disabling jevent generation

Auto-detecting system features:
<SNIP>
...                               libpython: [ OFF ]
⬢[acme@...lbox perf]$

If I then uninstall python2:

⬢[acme@...lbox perf]$ sudo dnf remove python2

It changes to:

Makefile.config:880: No python interpreter was found: disables Python support - please install python-devel/python-dev
Makefile.config:915: No python interpreter disabling jevent generation

Which is more sensible, then if I install python-devel:

⬢[acme@...lbox perf]$ sudo dnf install python-devel

$ sudo dnf install python-devel

I see no warnings, clean build and libpython detected:

...                               libpython: [ on  ]


⬢[acme@...lbox perf]$ ldd /tmp/build/perf/perf | grep python
	libpython3.10.so.1.0 => /lib64/libpython3.10.so.1.0 (0x00007f1eea200000)
⬢[acme@...lbox perf]$

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ