* [PATCH] perf tools: Fix python extension build
@ 2016-02-27 20:21 Jiri Olsa
2016-02-29 13:20 ` Josh Boyer
2016-03-05 8:12 ` [tip:perf/core] " tip-bot for Jiri Olsa
0 siblings, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2016-02-27 20:21 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Linux-Kernel@Vger. Kernel. Org, Josh Boyer, David Ahern,
Namhyung Kim, Peter Zijlstra
On Fri, Feb 26, 2016 at 11:59:03PM +0100, Jiri Olsa wrote:
> On Fri, Feb 26, 2016 at 05:49:02PM -0500, Josh Boyer wrote:
>
> SNIP
>
> > > ./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
> >
> > I don't think anything under python_ext_build/tmp/ actually matters in
> > any significant way. As long as this doesn't negatively impact
> > something via side-effect, it's probably good enough.
>
> right, and it's probably generic sollution too
>
> >
> > Will you write up a full patch?
>
> yep, will post it tomorrow
>
> jirka
sending full patch
jirka
---
The util/python-ext-sources file contains sources files
for python extension relative to $(srctree)/tools/perf,
Such a file path $(FILE).c is handed over to the python
extension build system, which builts final object in
$(PYTHON_EXTBUILD)/tmp/$(FILE).o path.
After build is done all files from $(PYTHON_EXTBUILD)lib/
are carried as the result binaries.
Above system fails when we add source file relative to
../lib, which we do for:
../lib/bitmap.c
../lib/find_bit.c
../lib/hweight.c
../lib/rbtree.c
All above objects will be built like:
$(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
$(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
$(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
$(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c
which accidentally happens to be final library path:
$(PYTHON_EXTBUILD)/lib/
Changing setup.py to pass full paths of source files
to Extension build class and thus keep all built objects
under $(PYTHON_EXTBUILD)tmp directory.
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
Link: http://lkml.kernel.org/n/tip-z14ivktbyblnz9ivuo0zau8l@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/setup.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1833103768cb..c8680984d2d6 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,9 @@ libapikfs = getenv('LIBAPI')
ext_sources = [f.strip() for f in file('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#']
+# use full paths with source files
+ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
+
perf = Extension('perf',
sources = ext_sources,
include_dirs = ['util/include'],
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] perf tools: Fix python extension build
2016-02-27 20:21 [PATCH] perf tools: Fix python extension build Jiri Olsa
@ 2016-02-29 13:20 ` Josh Boyer
2016-02-29 14:08 ` Arnaldo Carvalho de Melo
2016-03-05 8:12 ` [tip:perf/core] " tip-bot for Jiri Olsa
1 sibling, 1 reply; 5+ messages in thread
From: Josh Boyer @ 2016-02-29 13:20 UTC (permalink / raw)
To: Jiri Olsa
Cc: Arnaldo Carvalho de Melo, Linux-Kernel@Vger. Kernel. Org,
David Ahern, Namhyung Kim, Peter Zijlstra
On Sat, Feb 27, 2016 at 3:21 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Fri, Feb 26, 2016 at 11:59:03PM +0100, Jiri Olsa wrote:
>> On Fri, Feb 26, 2016 at 05:49:02PM -0500, Josh Boyer wrote:
>>
>> SNIP
>>
>> > > ./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
>> >
>> > I don't think anything under python_ext_build/tmp/ actually matters in
>> > any significant way. As long as this doesn't negatively impact
>> > something via side-effect, it's probably good enough.
>>
>> right, and it's probably generic sollution too
>>
>> >
>> > Will you write up a full patch?
>>
>> yep, will post it tomorrow
>>
>> jirka
>
> sending full patch
>
> jirka
>
>
> ---
> The util/python-ext-sources file contains sources files
> for python extension relative to $(srctree)/tools/perf,
>
> Such a file path $(FILE).c is handed over to the python
> extension build system, which builts final object in
> $(PYTHON_EXTBUILD)/tmp/$(FILE).o path.
>
> After build is done all files from $(PYTHON_EXTBUILD)lib/
> are carried as the result binaries.
>
> Above system fails when we add source file relative to
> ../lib, which we do for:
>
> ../lib/bitmap.c
> ../lib/find_bit.c
> ../lib/hweight.c
> ../lib/rbtree.c
>
> All above objects will be built like:
>
> $(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
> $(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
> $(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
> $(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c
>
> which accidentally happens to be final library path:
> $(PYTHON_EXTBUILD)/lib/
>
> Changing setup.py to pass full paths of source files
> to Extension build class and thus keep all built objects
> under $(PYTHON_EXTBUILD)tmp directory.
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
> Link: http://lkml.kernel.org/n/tip-z14ivktbyblnz9ivuo0zau8l@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
The Reported-by: tag should probably be changed to Jeff Bastian
<jbastian@redhat.com> if there's still time. He reported the original
bug. Maybe also include this in stable for 4.2+?
I'll be putting this into Fedora Rawhide today. Thanks!
josh
> ---
> tools/perf/util/setup.py | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> index 1833103768cb..c8680984d2d6 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,9 @@ libapikfs = getenv('LIBAPI')
> ext_sources = [f.strip() for f in file('util/python-ext-sources')
> if len(f.strip()) > 0 and f[0] != '#']
>
> +# use full paths with source files
> +ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
> +
> perf = Extension('perf',
> sources = ext_sources,
> include_dirs = ['util/include'],
> --
> 2.4.3
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf tools: Fix python extension build
2016-02-29 13:20 ` Josh Boyer
@ 2016-02-29 14:08 ` Arnaldo Carvalho de Melo
2016-02-29 19:58 ` Josh Boyer
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-02-29 14:08 UTC (permalink / raw)
To: Josh Boyer
Cc: Jiri Olsa, Linux-Kernel@Vger. Kernel. Org, David Ahern,
Namhyung Kim, Peter Zijlstra
Em Mon, Feb 29, 2016 at 08:20:33AM -0500, Josh Boyer escreveu:
> On Sat, Feb 27, 2016 at 3:21 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Fri, Feb 26, 2016 at 11:59:03PM +0100, Jiri Olsa wrote:
> >> On Fri, Feb 26, 2016 at 05:49:02PM -0500, Josh Boyer wrote:
> >>
> >> SNIP
> >>
> >> > > ./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
> >> >
> >> > I don't think anything under python_ext_build/tmp/ actually matters in
> >> > any significant way. As long as this doesn't negatively impact
> >> > something via side-effect, it's probably good enough.
> >>
> >> right, and it's probably generic sollution too
> >>
> >> >
> >> > Will you write up a full patch?
> >>
> >> yep, will post it tomorrow
> >>
> >> jirka
> >
> > sending full patch
> >
> > jirka
> >
> >
> > ---
> > The util/python-ext-sources file contains sources files
> > for python extension relative to $(srctree)/tools/perf,
> >
> > Such a file path $(FILE).c is handed over to the python
> > extension build system, which builts final object in
> > $(PYTHON_EXTBUILD)/tmp/$(FILE).o path.
> >
> > After build is done all files from $(PYTHON_EXTBUILD)lib/
> > are carried as the result binaries.
> >
> > Above system fails when we add source file relative to
> > ../lib, which we do for:
> >
> > ../lib/bitmap.c
> > ../lib/find_bit.c
> > ../lib/hweight.c
> > ../lib/rbtree.c
> >
> > All above objects will be built like:
> >
> > $(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
> > $(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
> > $(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
> > $(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c
> >
> > which accidentally happens to be final library path:
> > $(PYTHON_EXTBUILD)/lib/
> >
> > Changing setup.py to pass full paths of source files
> > to Extension build class and thus keep all built objects
> > under $(PYTHON_EXTBUILD)tmp directory.
> >
> > Cc: David Ahern <dsahern@gmail.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
> > Link: http://lkml.kernel.org/n/tip-z14ivktbyblnz9ivuo0zau8l@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>
> The Reported-by: tag should probably be changed to Jeff Bastian
> <jbastian@redhat.com> if there's still time. He reported the original
> bug. Maybe also include this in stable for 4.2+?
Sure, I'll use Jeff in the Reported-by: tag and have it CCed to stable,
I also will add a Tested-by: Josh Boyer, ok?
Thanks
> I'll be putting this into Fedora Rawhide today. Thanks!
>
> josh
>
> > ---
> > tools/perf/util/setup.py | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
> > index 1833103768cb..c8680984d2d6 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,9 @@ libapikfs = getenv('LIBAPI')
> > ext_sources = [f.strip() for f in file('util/python-ext-sources')
> > if len(f.strip()) > 0 and f[0] != '#']
> >
> > +# use full paths with source files
> > +ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
> > +
> > perf = Extension('perf',
> > sources = ext_sources,
> > include_dirs = ['util/include'],
> > --
> > 2.4.3
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf tools: Fix python extension build
2016-02-29 14:08 ` Arnaldo Carvalho de Melo
@ 2016-02-29 19:58 ` Josh Boyer
0 siblings, 0 replies; 5+ messages in thread
From: Josh Boyer @ 2016-02-29 19:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Jiri Olsa, Linux-Kernel@Vger. Kernel. Org, David Ahern,
Namhyung Kim, Peter Zijlstra
On Mon, Feb 29, 2016 at 9:08 AM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Mon, Feb 29, 2016 at 08:20:33AM -0500, Josh Boyer escreveu:
>> On Sat, Feb 27, 2016 at 3:21 PM, Jiri Olsa <jolsa@redhat.com> wrote:
>> > On Fri, Feb 26, 2016 at 11:59:03PM +0100, Jiri Olsa wrote:
>> >> On Fri, Feb 26, 2016 at 05:49:02PM -0500, Josh Boyer wrote:
>> >>
>> >> SNIP
>> >>
>> >> > > ./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
>> >> >
>> >> > I don't think anything under python_ext_build/tmp/ actually matters in
>> >> > any significant way. As long as this doesn't negatively impact
>> >> > something via side-effect, it's probably good enough.
>> >>
>> >> right, and it's probably generic sollution too
>> >>
>> >> >
>> >> > Will you write up a full patch?
>> >>
>> >> yep, will post it tomorrow
>> >>
>> >> jirka
>> >
>> > sending full patch
>> >
>> > jirka
>> >
>> >
>> > ---
>> > The util/python-ext-sources file contains sources files
>> > for python extension relative to $(srctree)/tools/perf,
>> >
>> > Such a file path $(FILE).c is handed over to the python
>> > extension build system, which builts final object in
>> > $(PYTHON_EXTBUILD)/tmp/$(FILE).o path.
>> >
>> > After build is done all files from $(PYTHON_EXTBUILD)lib/
>> > are carried as the result binaries.
>> >
>> > Above system fails when we add source file relative to
>> > ../lib, which we do for:
>> >
>> > ../lib/bitmap.c
>> > ../lib/find_bit.c
>> > ../lib/hweight.c
>> > ../lib/rbtree.c
>> >
>> > All above objects will be built like:
>> >
>> > $(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
>> > $(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
>> > $(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
>> > $(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c
>> >
>> > which accidentally happens to be final library path:
>> > $(PYTHON_EXTBUILD)/lib/
>> >
>> > Changing setup.py to pass full paths of source files
>> > to Extension build class and thus keep all built objects
>> > under $(PYTHON_EXTBUILD)tmp directory.
>> >
>> > Cc: David Ahern <dsahern@gmail.com>
>> > Cc: Namhyung Kim <namhyung@kernel.org>
>> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> > Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
>> > Link: http://lkml.kernel.org/n/tip-z14ivktbyblnz9ivuo0zau8l@git.kernel.org
>> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>>
>> The Reported-by: tag should probably be changed to Jeff Bastian
>> <jbastian@redhat.com> if there's still time. He reported the original
>> bug. Maybe also include this in stable for 4.2+?
>
> Sure, I'll use Jeff in the Reported-by: tag and have it CCed to stable,
>
> I also will add a Tested-by: Josh Boyer, ok?
Yes, that is fine. I tested the build and the resulting python-perf
package only has the proper contents. I see you've added this to the
formal patch, so thank you. Apologies for the delayed reply.
josh
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf tools: Fix python extension build
2016-02-27 20:21 [PATCH] perf tools: Fix python extension build Jiri Olsa
2016-02-29 13:20 ` Josh Boyer
@ 2016-03-05 8:12 ` tip-bot for Jiri Olsa
1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-03-05 8:12 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, hpa, acme, linux-kernel, mingo, tglx, jolsa, dsahern,
namhyung, a.p.zijlstra, jwboyer, jbastian
Commit-ID: 67d5268908283c187e0a460048a423256c2fb288
Gitweb: http://git.kernel.org/tip/67d5268908283c187e0a460048a423256c2fb288
Author: Jiri Olsa <jolsa@redhat.com>
AuthorDate: Sat, 27 Feb 2016 21:21:12 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 29 Feb 2016 11:18:25 -0300
perf tools: Fix python extension build
The util/python-ext-sources file contains source files required to build
the python extension relative to $(srctree)/tools/perf,
Such a file path $(FILE).c is handed over to the python extension build
system, which builds the final object in the
$(PYTHON_EXTBUILD)/tmp/$(FILE).o path.
After the build is done all files from $(PYTHON_EXTBUILD)lib/ are
carried as the result binaries.
Above system fails when we add source file relative to ../lib, which we
do for:
../lib/bitmap.c
../lib/find_bit.c
../lib/hweight.c
../lib/rbtree.c
All above objects will be built like:
$(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
$(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
$(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
$(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c
which accidentally happens to be final library path:
$(PYTHON_EXTBUILD)/lib/
Changing setup.py to pass full paths of source files to Extension build
class and thus keep all built objects under $(PYTHON_EXTBUILD)tmp
directory.
Reported-by: Jeff Bastian <jbastian@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Josh Boyer <jwboyer@fedoraproject.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@vger.kernel.org # v4.2+
Link: http://lkml.kernel.org/r/20160227201350.GB28494@krava.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/setup.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1833103..c868098 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,9 @@ libapikfs = getenv('LIBAPI')
ext_sources = [f.strip() for f in file('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#']
+# use full paths with source files
+ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
+
perf = Extension('perf',
sources = ext_sources,
include_dirs = ['util/include'],
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-05 8:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-27 20:21 [PATCH] perf tools: Fix python extension build Jiri Olsa
2016-02-29 13:20 ` Josh Boyer
2016-02-29 14:08 ` Arnaldo Carvalho de Melo
2016-02-29 19:58 ` Josh Boyer
2016-03-05 8:12 ` [tip:perf/core] " tip-bot for Jiri Olsa
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.