Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1716291ybl; Sat, 25 Jan 2020 06:57:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzeIAwEa0c/2+yD5Kf5D4S6KZ3rOwfPW/y/BuOOI4mGDWTCh0+nwuvz3WS+f3kT+g4jHDXF X-Received: by 2002:a9d:7b50:: with SMTP id f16mr6571153oto.18.1579964248608; Sat, 25 Jan 2020 06:57:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579964248; cv=none; d=google.com; s=arc-20160816; b=gEPQRtdeENIIs5oPN0+bqMP8NRqJux1OEN6DqKfKi3KVHQyP56rB3MAXRewsz4CJbx HDZwo9JD39tmYO98f4/LCoX3Jg+tpMB4+KR8HRSoaWWsp+W6b6ScOY68xPYlYjxmKBma 0vxQZlg4FQHGocduZVSHFBZ+LerKJA5+Q6k7ZZHYtveWZd7DQO73e5AI0uQlpf2dO5QL lDrDS9XKclfTNdPHdPIEb19oHO8y9++aTSc4gK4DT3aRCokk+H/k1FP9VOAeTN1tgac9 0DZ61UABYNgD02BGh/J4alMik6j18wsYddH/aLpDWwupoUP9BJeydYbGXA/tqVC8TdGI cjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=azzlYV9p2BdWsb/G+vunmwq5xYwbi8a1Kds9SQOTNYk=; b=AADUPKGhdxJH0MJppIIm0+mFdb4xSoxWG7MCU6HOoDYdlx9zwWuZ401w5/6srFUC0Z VCePoKOeWwiBVzGmZAkYAg3mOSZ3fX0pwGdhGl5Hhgy11gVJ/6n9vE17IgyLwXxU5Vxv g6i5/4ONmlie6cjy1S5iRtN/QEEPHF91Ff9612KPBNSuMWK/qmjM3Vab5vjE08EoidJU A8ATl9VV0IRVJGVuV9Vk8X7UsXW/jxVerBF6gwKqY0EGMnrM2cug6qLybK6HtKXIgjIc MipeihxyAtRecZ+XtK7Ul27Kq/sp2KlvSRD27+vcoc+Ftcwyl40SX7GtXk/rwpyMwuDl QsFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iNm0Po0V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si4277924oto.287.2020.01.25.06.57.16; Sat, 25 Jan 2020 06:57:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iNm0Po0V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbgAYO4Y (ORCPT + 99 others); Sat, 25 Jan 2020 09:56:24 -0500 Received: from mail-il1-f196.google.com ([209.85.166.196]:39914 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgAYO4X (ORCPT ); Sat, 25 Jan 2020 09:56:23 -0500 Received: by mail-il1-f196.google.com with SMTP id p18so1108541ils.6 for ; Sat, 25 Jan 2020 06:56:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=azzlYV9p2BdWsb/G+vunmwq5xYwbi8a1Kds9SQOTNYk=; b=iNm0Po0Vn8OnFRJrKJhtWkEGXtyQSksmqnjCk3bGXbOJmKnmON5nmDURF009dVsZQ7 G5NAO1Ff93tdYjTk9A6+o3gInvUHW4yc3ZlQskj7mu3AJAABTb0LTIiP4uaHY4atW3ie tPLfadmg5NIQnuNVJDYiupfWkHmb1GcPkQvXOBJbZQaiCqlEXZN2/qxRpg6dlWDWc+Eg J6VMtvHbuQbhwwItn02lfY2O+g2d8QOhUGKamrsuI9durlbNteAUcdgYWsMGYaGnWiJw Os8F3yrdkShsSLjZCyHK8GEJo7OSRIWBBTKdU82iXj7PouxmShTvNZBI9xDLp0qROXX1 dTOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=azzlYV9p2BdWsb/G+vunmwq5xYwbi8a1Kds9SQOTNYk=; b=bnIB8ClrX9JLMmdt7ihxnXt5aTihv9XIjgw1uVObtvaLw/X3gShP7i5W+XPLAkS2vM wEDHmSdAVEViZrY/Xj1yorxvow5Kkw3yDxXSz7bR267VMf0iPh8KMSIcO/yNv34G9sK0 vm7g2u4nF+PtvjKyr2AsjM/Adiq4ix7OFEnfJSA0GaQYEUyziqNW831I+rsHUZH61LM9 dqZLVYuX2v+ChxkxQeiIbmmDdbN6dW42D5F8vKw5mW3G4sv9FN99WfkPVv+q2xloumFq xBfqVrlI2SBYvHjKgQlPzquhk365pgPNf54skhmUNjDWov91/tgTDCT0kJ/2mxUU1UHX woPg== X-Gm-Message-State: APjAAAXIXoh3cHJklm5/cWdpHz728SUuZv4ZsNtzIA+LIpTOcNyAxDb3 rc2CicG1ugGQKNBWUCsGbDp/rDy+/CLpIOEBquu/oPAxoDQ= X-Received: by 2002:a92:c990:: with SMTP id y16mr8035628iln.109.1579964182834; Sat, 25 Jan 2020 06:56:22 -0800 (PST) MIME-Version: 1.0 From: Sam Lunt Date: Sat, 25 Jan 2020 08:56:12 -0600 Message-ID: Subject: [PATCH] perf: Support Python 3.8+ in Makefile To: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org Cc: mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, trivial@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Python 3.8 changed the output of 'python-config --ldflags' to no longer include the '-lpythonX.Y' flag (this apparently fixed an issue loading modules with a statically linked Python executable). The libpython feature check in linux/build/feature fails if the Python library is not included in FEATURE_CHECK_LDFLAGS-libpython variable. This adds a check in the Makefile to determine if PYTHON_CONFIG accepts the '--embed' flag and passes that flag alongside '--ldflags' if so. tools/perf is the only place the libpython feature check is used. Signed-off-by: Sam Lunt --- tools/perf/Makefile.config | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c90f4146e5a2..ccf99351f058 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -228,8 +228,17 @@ strip-libs = $(filter-out -l%,$(1)) PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) +# Python 3.8 changed the output of `python-config --ldflags` to not include the +# '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for +# libpython fails if that flag is not included in LDFLAGS +ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0) + PYTHON_CONFIG_LDFLAGS := --ldflags --embed +else + PYTHON_CONFIG_LDFLAGS := --ldflags +endif + ifdef PYTHON_CONFIG - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) + PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_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) --includes 2>/dev/null) base-commit: d5d359b0ac3ffc319ca93c46a4cfd87093759ad6 -- 2.25.0