aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@infradead.org>2012-10-18 10:38:35 -0400
committerIngo Molnar <mingo@kernel.org>2012-10-19 20:43:08 -0400
commit45bff41a9a6f22af28e4ba22f83c87f619e573a8 (patch)
tree3b7b76347fe6e0f1c23352ceb0d0b70b59da5a06
parenta448a0318af1a11b8f54d01a349b0036a3cff965 (diff)
perf python: Properly link with libtraceevent
Namhyung Kim reported that the build fails with: GEN python/perf.so gcc: error: python_ext_build/tmp//../../libtraceevent.a: No such file or directory error: command 'gcc' failed with exit status 1 cp: cannot stat `python_ext_build/lib/perf.so': No such file or directory make: *** [python/perf.so] Error 1 We need to propagate the TE_PATH variable to the setup.py file. Reported-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lkml.kernel.org/n/tip-8umiPbm4sxpknKivbjgykhut@git.kernel.org [ Fixed superfluous variable build error. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/perf/Makefile24
-rw-r--r--tools/perf/util/python.c2
-rw-r--r--tools/perf/util/setup.py3
3 files changed, 15 insertions, 14 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f7c968ad5178..00deed4d6159 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -184,9 +184,22 @@ SCRIPT_SH += perf-archive.sh
184grep-libs = $(filter -l%,$(1)) 184grep-libs = $(filter -l%,$(1))
185strip-libs = $(filter-out -l%,$(1)) 185strip-libs = $(filter-out -l%,$(1))
186 186
187TRACE_EVENT_DIR = ../lib/traceevent/
188
189ifneq ($(OUTPUT),)
190 TE_PATH=$(OUTPUT)
191else
192 TE_PATH=$(TRACE_EVENT_DIR)
193endif
194
195LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
196TE_LIB := -L$(TE_PATH) -ltraceevent
197
187PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) 198PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
188PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py 199PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py
189 200
201export LIBTRACEEVENT
202
190$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) 203$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
191 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ 204 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
192 --quiet build_ext; \ 205 --quiet build_ext; \
@@ -198,17 +211,6 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
198 211
199SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) 212SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
200 213
201TRACE_EVENT_DIR = ../lib/traceevent/
202
203ifneq ($(OUTPUT),)
204 TE_PATH=$(OUTPUT)
205else
206 TE_PATH=$(TRACE_EVENT_DIR)
207endif
208
209LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
210TE_LIB := -L$(TE_PATH) -ltraceevent
211
212# 214#
213# Single 'perf' binary right now: 215# Single 'perf' binary right now:
214# 216#
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index a2657fd96837..9181bf212fb9 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -1015,8 +1015,6 @@ PyMODINIT_FUNC initperf(void)
1015 pyrf_cpu_map__setup_types() < 0) 1015 pyrf_cpu_map__setup_types() < 0)
1016 return; 1016 return;
1017 1017
1018 page_size = sysconf(_SC_PAGE_SIZE);
1019
1020 Py_INCREF(&pyrf_evlist__type); 1018 Py_INCREF(&pyrf_evlist__type);
1021 PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type); 1019 PyModule_AddObject(module, "evlist", (PyObject*)&pyrf_evlist__type);
1022 1020
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 09c3cea95d3b..73d510269784 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -23,6 +23,7 @@ cflags += getenv('CFLAGS', '').split()
23 23
24build_lib = getenv('PYTHON_EXTBUILD_LIB') 24build_lib = getenv('PYTHON_EXTBUILD_LIB')
25build_tmp = getenv('PYTHON_EXTBUILD_TMP') 25build_tmp = getenv('PYTHON_EXTBUILD_TMP')
26libtraceevent = getenv('LIBTRACEEVENT')
26 27
27ext_sources = [f.strip() for f in file('util/python-ext-sources') 28ext_sources = [f.strip() for f in file('util/python-ext-sources')
28 if len(f.strip()) > 0 and f[0] != '#'] 29 if len(f.strip()) > 0 and f[0] != '#']
@@ -31,7 +32,7 @@ perf = Extension('perf',
31 sources = ext_sources, 32 sources = ext_sources,
32 include_dirs = ['util/include'], 33 include_dirs = ['util/include'],
33 extra_compile_args = cflags, 34 extra_compile_args = cflags,
34 extra_objects = [build_tmp + '/../../libtraceevent.a'], 35 extra_objects = [libtraceevent],
35 ) 36 )
36 37
37setup(name='perf', 38setup(name='perf',