All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, eranian@google.com,
	alexander.shishkin@linux.intel.com, tglx@linutronix.de,
	mhiramat@kernel.org, davidcc@google.com, peterz@infradead.org,
	ak@linux.intel.com, hpa@zytor.com, mingo@kernel.org,
	sque@chromium.org, linux-kernel@vger.kernel.org, pjt@google.com,
	hekuang@huawei.com, jolsa@kernel.org, wangnan0@huawei.com
Subject: [tip:perf/core] perf tools: Pass PYTHON config to feature detection
Date: Mon, 17 Apr 2017 01:33:49 -0700	[thread overview]
Message-ID: <tip-7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a@git.kernel.org> (raw)
In-Reply-To: <20170412064919.92449-2-davidcc@google.com>

Commit-ID:  7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a
Gitweb:     http://git.kernel.org/tip/7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Tue, 11 Apr 2017 23:49:13 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 12 Apr 2017 10:45:21 -0300

perf tools: Pass PYTHON config to feature detection

( This is a rebased version of https://lkml.org/lkml/2017/2/7/662 )

Python's CC and link Makefile variables were not passed to feature
detection, causing feature detection to use system's Python rather than
PYTHON_CONFIG's one. This created a mismatch between the detected Python
support and the one actually used by perf when PYTHON_CONFIG is
specified.

Fix it by moving Python's variable initialization to before feature
detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
build target.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Simon Que <sque@chromium.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170412064919.92449-2-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/feature/Makefile |  2 +-
 tools/perf/Makefile.config   | 31 ++++++++++++-------------------
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 09c9626..523e587 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin:
 	$(BUILD) $(FLAGS_PERL_EMBED)
 
 $(OUTPUT)test-libpython.bin:
-	$(BUILD)
+	$(BUILD) $(FLAGS_PYTHON_EMBED)
 
 $(OUTPUT)test-libpython-version.bin:
 	$(BUILD)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 2b656de..cfd6015 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
 override PYTHON_CONFIG := \
   $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
 
-PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+grep-libs  = $(filter -l%,$(1))
+strip-libs  = $(filter-out -l%,$(1))
 
-PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
 
-ifeq ($(CC), clang)
-  PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
+ifdef PYTHON_CONFIG
+  PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+  PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
+  PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
+  PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+  ifeq ($(CC), clang)
+    PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
+  endif
+  FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
 endif
 
 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
@@ -554,8 +561,6 @@ ifndef NO_GTK2
   endif
 endif
 
-grep-libs  = $(filter -l%,$(1))
-strip-libs = $(filter-out -l%,$(1))
 
 ifdef NO_LIBPERL
   CFLAGS += -DNO_LIBPERL
@@ -603,21 +608,9 @@ else
       $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
     else
 
-      PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
-
-      PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-      PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
-      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-      ifeq ($(CC), clang)
-        PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
-      endif
-      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
-
       ifneq ($(feature-libpython), 1)
         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
       else
-
         ifneq ($(feature-libpython-version), 1)
           $(warning Python 3 is not yet supported; please set)
           $(warning PYTHON and/or PYTHON_CONFIG appropriately.)

  reply	other threads:[~2017-04-17  8:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  6:49 [PATCH 0/6] perf tool: build and usage hints David Carrillo-Cisneros
2017-04-12  6:49 ` [PATCH 1/6] perf tools: pass PYTHON config to feature detection David Carrillo-Cisneros
2017-04-17  8:33   ` tip-bot for David Carrillo-Cisneros [this message]
2017-04-12  6:49 ` [PATCH 2/6] tools build: fix feature detection redefinion of build flags David Carrillo-Cisneros
2017-04-17  8:35   ` [tip:perf/core] tools build: Fix " tip-bot for David Carrillo-Cisneros
2017-04-12  6:49 ` [PATCH 2/6] tools build: fix feature redefine " David Carrillo-Cisneros
2017-04-12  7:56   ` Jiri Olsa
2017-04-12 16:30     ` David Carrillo-Cisneros
2017-04-13 14:52       ` Arnaldo Carvalho de Melo
2017-04-12  6:49 ` [PATCH 3/6] perf util: hint missing file when tool tips fail to load David Carrillo-Cisneros
2017-04-17  8:36   ` [tip:perf/core] perf util: Hint " tip-bot for David Carrillo-Cisneros
2017-04-12  6:49 ` [PATCH 4/6] perf report: hint .perfconfig error when invalid sorting key David Carrillo-Cisneros
2017-04-12  8:17   ` Jiri Olsa
2017-04-12 16:34     ` David Carrillo-Cisneros
2017-04-13 14:53       ` Arnaldo Carvalho de Melo
2017-04-12  6:49 ` [PATCH 5/6] perf tools: disable JVMTI if no ELF support available David Carrillo-Cisneros
2017-04-12  8:19   ` Jiri Olsa
2017-04-12 17:07     ` David Carrillo-Cisneros
2017-04-12 17:33       ` Jiri Olsa
2017-04-13 14:47         ` Arnaldo Carvalho de Melo
2017-04-17  8:35       ` [tip:perf/core] perf tools: Disable " tip-bot for David Carrillo-Cisneros
2017-04-13 11:40   ` [PATCH 5/6] perf tools: disable " Kim Phillips
2017-04-12  6:49 ` [PATCH 6/6] Revert "perf tools: Fix include of linux/mman.h" David Carrillo-Cisneros
2017-04-17  8:36   ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-04-12  8:20 ` [PATCH 0/6] perf tool: build and usage hints Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=davidcc@google.com \
    --cc=eranian@google.com \
    --cc=hekuang@huawei.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=sque@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.