diff options
author | Arnaldo Carvalho de Melo <acme@infradead.org> | 2012-10-18 10:38:35 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-10-19 20:43:08 -0400 |
commit | 45bff41a9a6f22af28e4ba22f83c87f619e573a8 (patch) | |
tree | 3b7b76347fe6e0f1c23352ceb0d0b70b59da5a06 | |
parent | a448a0318af1a11b8f54d01a349b0036a3cff965 (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/Makefile | 24 | ||||
-rw-r--r-- | tools/perf/util/python.c | 2 | ||||
-rw-r--r-- | tools/perf/util/setup.py | 3 |
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 | |||
184 | grep-libs = $(filter -l%,$(1)) | 184 | grep-libs = $(filter -l%,$(1)) |
185 | strip-libs = $(filter-out -l%,$(1)) | 185 | strip-libs = $(filter-out -l%,$(1)) |
186 | 186 | ||
187 | TRACE_EVENT_DIR = ../lib/traceevent/ | ||
188 | |||
189 | ifneq ($(OUTPUT),) | ||
190 | TE_PATH=$(OUTPUT) | ||
191 | else | ||
192 | TE_PATH=$(TRACE_EVENT_DIR) | ||
193 | endif | ||
194 | |||
195 | LIBTRACEEVENT = $(TE_PATH)libtraceevent.a | ||
196 | TE_LIB := -L$(TE_PATH) -ltraceevent | ||
197 | |||
187 | PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) | 198 | PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) |
188 | PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py | 199 | PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py |
189 | 200 | ||
201 | export 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 | ||
199 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) | 212 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) |
200 | 213 | ||
201 | TRACE_EVENT_DIR = ../lib/traceevent/ | ||
202 | |||
203 | ifneq ($(OUTPUT),) | ||
204 | TE_PATH=$(OUTPUT) | ||
205 | else | ||
206 | TE_PATH=$(TRACE_EVENT_DIR) | ||
207 | endif | ||
208 | |||
209 | LIBTRACEEVENT = $(TE_PATH)libtraceevent.a | ||
210 | TE_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 | ||
24 | build_lib = getenv('PYTHON_EXTBUILD_LIB') | 24 | build_lib = getenv('PYTHON_EXTBUILD_LIB') |
25 | build_tmp = getenv('PYTHON_EXTBUILD_TMP') | 25 | build_tmp = getenv('PYTHON_EXTBUILD_TMP') |
26 | libtraceevent = getenv('LIBTRACEEVENT') | ||
26 | 27 | ||
27 | ext_sources = [f.strip() for f in file('util/python-ext-sources') | 28 | ext_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 | ||
37 | setup(name='perf', | 38 | setup(name='perf', |