Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp918584ybl; Fri, 31 Jan 2020 10:20:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzQwJX0EMjH9jyinU+SbU6ECyd0DpgZy8G5yRrs1+dCrqRduNzfVO3v72KEDZ6UEZCN4xS0 X-Received: by 2002:a9d:51c1:: with SMTP id d1mr8166134oth.136.1580494839048; Fri, 31 Jan 2020 10:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580494839; cv=none; d=google.com; s=arc-20160816; b=IfvwMNC2ELyzjJWQhhdZNMAgORP6da6A7pdfRj198hF33iNUoe3ko7wg3LQoIyTqeD 0+wAJImf0I1Hk+2F6wmDdfHpybw58gCFekbiHlV/i5ZQQ9QpIv042NCVgvo5SNLl5Z+8 mfz29SvxyI/WIuGurYc9eHChQdz0TTKaF+qjXVRiwqrnH31/psoDYRdhG5eYC2FQ+7Rt tSG6ttH5/Bl3hzbXCoJsBKqAnBsmR+dE1zcb6PBVkbK2ALu2vcj1nGRyzeMqE78MkrDi W70xSP0ZEQfRreCtRqoYsiNK66KYw0V7pqpHHBMEsc2kIbF+51FbZXsPm4ONZkNpe1mN CVhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:date:from:dkim-signature; bh=4VYyzzGXvpkoeXPD6VYi8iy20yoxe+qDPS3ZbJdgxSw=; b=UFTidewLgerySsc2CZxArXAkuV+fbpdsfprhcvfTUDdRfW3YkGWe5rZGbpH/+pGt28 QMuQXMuY/nkUHbx15UP4HHZps7AgupAWOfO5aqMb15ETOurcTDLeVjCNcksyQ9kaEP1U qQOeQJhuX5lyzvTbD52j4VjSA8dsGLOyPjt7tGe5AOjF4TVMhwYJnPw7UftDDcTZyNCc W0q3y0Xqw2gxRi0WHczC02886/2DlQHTJCK+HgLPV4d8lax3ZwDqa4pWDezZX+MlF+IL oKSN2wKCkq9ZvnsqLX9EFiNPc+KKwYhL1DYkO6ClrJuN17v86GJa6Kduc096Zq40o6/S c5WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AGei6Lyy; 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 v11si5243914otp.279.2020.01.31.10.20.27; Fri, 31 Jan 2020 10:20:39 -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=AGei6Lyy; 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 S1726102AbgAaSSe (ORCPT + 99 others); Fri, 31 Jan 2020 13:18:34 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:37720 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbgAaSSe (ORCPT ); Fri, 31 Jan 2020 13:18:34 -0500 Received: by mail-yw1-f66.google.com with SMTP id l5so5621390ywd.4 for ; Fri, 31 Jan 2020 10:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:mime-version:content-disposition; bh=4VYyzzGXvpkoeXPD6VYi8iy20yoxe+qDPS3ZbJdgxSw=; b=AGei6LyyPbL/uS3xnhgCFxDlX8FD9ZLRHfuc2U2PwbDRurtaUx4dQiSMRQ9jPQ6LfJ 4/QcpR9QdvlN2irxJcd6/SepI3rNFHDWBlVM4QYqBOIQH5ky7mXuNbOiKQbMjY1fgvED 9UszIyqchT/Y7Tf1v4/nWRJ5C15HURAJiRJ5lwnx1XOI7RwsHjLfg6LpXr0IH3ff0nT1 +nv264uCbz0jkfnDPbzbAl/lNAVHrL4tezJyQKAswTLYK6ui2opfY/uddMz3gGpJScJK ByO5uHCpavsKvp4wfgUXznB89PuXEG/bkTDk6V1UVNvbNNL4hktgEP6yUeoXhcmfFu/j GWGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:mime-version :content-disposition; bh=4VYyzzGXvpkoeXPD6VYi8iy20yoxe+qDPS3ZbJdgxSw=; b=Wff5sjWQR1VzWTQljkv2VUHKTSG5Uj5/BissdwZOUD9hod5g/P22qMvrzE/yLDqTwO Xki89XBVJ3pfb8fzXBRpBOJn62yfzCsvpJpjDUkvJmh6pmLvMeoCbG6kSousmzDaqBVb lZo054XBCCjlljjbQVS7/tQNA1XkORxXgPjAVpBgVtqE3eIcGvKjddCeFcaGSJ98uTdG 3JOu5Y74KlaMPkzDIoZal3qJ2jRuxEIms+QYx/MC61lxQHwWaIt/olikvfLqiH2gu6TZ WJrD1JNlE/dyIaMN8Bfma+o4dSwyaJ5Z3tZxnQ2JPdSkJDYzpNF8uU9PWx/vjw+yI+5s 8GIw== X-Gm-Message-State: APjAAAVDi5FAuKVP6L9cQqfM+/D215znbcWKo8UnGJbyj8hcNcCLl+Vb OkXGR15LbqV3/w2obgw47AJ09no9ibY= X-Received: by 2002:a25:9c01:: with SMTP id c1mr9362229ybo.200.1580494284802; Fri, 31 Jan 2020 10:11:24 -0800 (PST) Received: from gmail.com ([2601:240:e300:b5b:329c:23ff:fea3:d48c]) by smtp.gmail.com with ESMTPSA id p62sm4438951ywc.44.2020.01.31.10.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 10:11:24 -0800 (PST) From: Sam Lunt X-Google-Original-From: Sam Lunt Date: Fri, 31 Jan 2020 12:11:23 -0600 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 Subject: [PATCH] perf: Support Python 3.8+ in Makefile Message-ID: <20200131181123.tmamivhq4b7uqasr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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