Skip to content

Commit 67d5268

Browse files
Jiri Olsaacmel
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> Tested-by: Josh Boyer <[email protected]> Cc: David Ahern <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] # v4.2+ Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 675965b commit 67d5268

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/perf/util/setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def finalize_options(self):
2222
# switch off several checks (need to be at the end of cflags list)
2323
cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
2424

25+
src_perf = getenv('srctree') + '/tools/perf'
2526
build_lib = getenv('PYTHON_EXTBUILD_LIB')
2627
build_tmp = getenv('PYTHON_EXTBUILD_TMP')
2728
libtraceevent = getenv('LIBTRACEEVENT')
@@ -30,6 +31,9 @@ def finalize_options(self):
3031
ext_sources = [f.strip() for f in file('util/python-ext-sources')
3132
if len(f.strip()) > 0 and f[0] != '#']
3233

34+
# use full paths with source files
35+
ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
36+
3337
perf = Extension('perf',
3438
sources = ext_sources,
3539
include_dirs = ['util/include'],

0 commit comments

Comments
 (0)