From: Jiri Olsa <jolsa@redhat.com>
To: Josh Boyer <jwboyer@fedoraproject.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>
Subject: Re: perf install-python_ext installing .o files in python site-packages
Date: Fri, 26 Feb 2016 22:14:35 +0100 [thread overview]
Message-ID: <20160226211435.GB19398@krava.redhat.com> (raw)
In-Reply-To: <CA+5PVA6S3zLUhL077PXfxdX0=jEa6fvzbygqfyP1eJgv5NSU+Q@mail.gmail.com>
On Fri, Feb 26, 2016 at 03:38:09PM -0500, Josh Boyer wrote:
> Hi Arnaldo,
>
> We've had a report [1] that the python-perf package in Fedora installs
> a handful of .o files in /usr/lib64/python2.7/site-packages/. This is
> true on Linus' latest tree, but it goes back to arriving with the 4.2
> kernel.
>
> Digging around a bit, it seems the files installed are those that are
> found as relative paths in the utils/python-ext-sources directory:
>
> /usr/lib64/python2.7/site-packages/bitmap.o
> /usr/lib64/python2.7/site-packages/find_bit.o
> /usr/lib64/python2.7/site-packages/hweight.o
> /usr/lib64/python2.7/site-packages/rbtree.o
>
> None of those files should really be installed at all, as they're
> temporary object files used to build perf.so.
>
> As far as I can tell, this is a side effect of using the python
> distutils module with it's setup.py script. The sources are listed
> there so they get included, but then the build_ext functionality
> interprets it as e.g.:
>
> -c ../lib/hweight.c -o python_ext_build/tmp/../lib/hweight.o
>
> That leaves it in the lib/ directory of the build output alongside the
> final perf.so instead of python_ext_build/tmp/util/ like the rest of
> the object files. It happens to be an unfortunate coincidence that
> install-lib looks in said .../lib/ directory and we just happen to
> conflict with that naming. So when install-python_ext is called, it
> simply copies everything in that directory, including the .o files.
>
> I'm not enough of a python wizard to figure out how to fix this
> quickly. We could remove the .o files in the .spec file, but that
> seems hacky and this should probably be fixed in the perf build
> system.
>
> Ideas?
looks like the python extension build system mixes
up the '../lib' source files with final lib, which
by 'accident' is located in '../lib' as well ;-)
using full paths for sources sorted this for me (patch attached)
but that will end up with following build tree:
./python_ext_build
./python_ext_build/lib
./python_ext_build/lib/perf.so
./python_ext_build/tmp
./python_ext_build/tmp/home
./python_ext_build/tmp/home/jolsa
./python_ext_build/tmp/home/jolsa/kernel
./python_ext_build/tmp/home/jolsa/kernel/linux-perf
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/counts.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/util.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/thread_map.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/cpumap.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/strlist.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/evlist.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/evsel.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/trace-event.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/xyarray.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/python.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/ctype.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/cgroup.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/rblist.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/perf/util/string.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/lib
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/lib/hweight.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/lib/rbtree.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/lib/bitmap.o
./python_ext_build/tmp/home/jolsa/kernel/linux-perf/tools/lib/find_bit.o
not sure we want to come up with some 'nicer' solution
jirka
---
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1833103768cb..6c4bb2ea3594 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -22,6 +22,7 @@ cflags = getenv('CFLAGS', '').split()
# switch off several checks (need to be at the end of cflags list)
cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
+src_perf = getenv('srctree') + '/tools/perf'
build_lib = getenv('PYTHON_EXTBUILD_LIB')
build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
@@ -30,6 +31,8 @@ libapikfs = getenv('LIBAPI')
ext_sources = [f.strip() for f in file('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#']
+ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
+
perf = Extension('perf',
sources = ext_sources,
include_dirs = ['util/include'],
next prev parent reply other threads:[~2016-02-26 21:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 20:38 Josh Boyer
2016-02-26 21:14 ` Jiri Olsa [this message]
2016-02-26 22:49 ` Josh Boyer
2016-02-26 22:59 ` Jiri Olsa
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=20160226211435.GB19398@krava.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=jwboyer@fedoraproject.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®