Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428471

[PATCH 4/5] perf tools: Let python use correct gcc for build_ext

From He Kuang <hekuang@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 4/5] perf tools: Let python use correct gcc for build_ext
Date 2016-06-22 09:00 +0200
Message-ID <rMKiJ-8pY-9@gated-at.bofh.it> (permalink)
References <rMKiJ-8pY-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Currently, python uses host gcc instead of cross-compile gcc in the
last step of compiling build_ext(remove '--quiet' to show verbose):

  cross-gcc ...
  cross-gcc ...
  creating ~/out/python_ext_build/lib
  gcc -pthread -shared -Wl,-z ...

This is wrong but may not cause any errors unless the features detected
by cross-compiler do not match those for host compiler, and causes the
following errors:

  /usr/lib64/gcc/bin/ld: cannot find -lunwind-x86
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  cp: cannot stat ‘~/out/python_ext_build/lib/perf.so’: No such file or directory
  Makefile.perf:257: recipe for target '~/out/python/perf.so' failed
  make[1]: *** [~/out/python/perf.so] Error 1
  Makefile:68: recipe for target 'all' failed
  make: *** [all] Error 2

This issue is also reported and anwsered on stackoverflow.
Link: http://stackoverflow.com/questions/5986256/python-distutils-gcc-path

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/Makefile.perf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bde8cba..d0a2cb1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -254,7 +254,8 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
-	$(QUIET_GEN)CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
+	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
+        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	mkdir -p $(OUTPUT)python && \
-- 
1.8.5.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Fixes on perf unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
  [PATCH 2/5] perf unwind: Fix wrongly used regs for x86_32 unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
  [PATCH 4/5] perf tools: Let python use correct gcc for build_ext He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
  [PATCH 1/5] perf unwind: Change macro names of perf register He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
  [PATCH 3/5] perf unwind: Fix wrongly used regs for aarch64 unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
  Re: [PATCH 0/5] Fixes on perf unwind Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 15:40 +0200

csiph-web