From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992604AbcB0UXM (ORCPT ); Sat, 27 Feb 2016 15:23:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35263 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992460AbcB0UXK (ORCPT ); Sat, 27 Feb 2016 15:23:10 -0500 Date: Sat, 27 Feb 2016 21:21:12 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: "Linux-Kernel@Vger. Kernel. Org" , Josh Boyer , David Ahern , Namhyung Kim , Peter Zijlstra Subject: [PATCH] perf tools: Fix python extension build Message-ID: <20160227201350.GB28494@krava.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 27 Feb 2016 20:23:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Namhyung Kim Cc: Peter Zijlstra Reported-by: Josh Boyer Link: http://lkml.kernel.org/n/tip-z14ivktbyblnz9ivuo0zau8l@git.kernel.org Signed-off-by: Jiri Olsa --- 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