From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362AbcFWVYh (ORCPT ); Thu, 23 Jun 2016 17:24:37 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:39585 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752214AbcFWVY2 (ORCPT ); Thu, 23 Jun 2016 17:24:28 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, He Kuang , Adrian Hunter , Alexander Shishkin , Andi Kleen , David Ahern , Ekaterina Tumanova , Jiri Olsa , Josh Poimboeuf , Kan Liang , Masami Hiramatsu , Namhyung Kim , Pekka Enberg , Peter Zijlstra , Stephane Eranian , Sukadev Bhattiprolu , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 13/27] perf tools: Let python use correct gcc for build_ext Date: Thu, 23 Jun 2016 18:24:00 -0300 Message-Id: <1466717054-31048-14-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466717054-31048-1-git-send-email-acme@kernel.org> References: <1466717054-31048-1-git-send-email-acme@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: He Kuang 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 Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Ekaterina Tumanova Cc: Jiri Olsa Cc: Josh Poimboeuf Cc: Kan Liang Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Pekka Enberg Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Sukadev Bhattiprolu Cc: Wang Nan Link: http://lkml.kernel.org/r/1466578626-92406-5-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 bde8cbae7dd9..d0a2cb11296f 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 && \ -- 2.5.5