Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1852056ybv; Thu, 6 Feb 2020 10:59:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyKlly5fBRP5Qbde/7jNhyJBqu8sKphR9ylxapDlrEMU59ISMhpNwm7Vxz249ZzJqc1Vfji X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr31907537otr.220.1581015563895; Thu, 06 Feb 2020 10:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581015563; cv=none; d=google.com; s=arc-20160816; b=jN79QKxbGL47+t/6lY+y+9s5kPQPjQcqj3TYJlk5oOpix6bALBDE923dvisyWKJTV6 RbEYaUM+jbVWGedndzf/w41p88jUO/Aro2BXKtyROC7j0LNrG4U/5gfS4y/d2k9r3la2 Uzt39bNB4ZudoV2+Devv3iYfhoE1Mz25meWgwaL5BWypyuHIglALVmW4l1xkRWrG7B65 BZhYcpzM6uV2X120hGAVDCp6R80pdjMU9w3TWXJcz/nAdjTZIKej2f7mkedIT1AJ7aMC qU8k8id8x0uOi6vNEbXoi8VwPJU6Bk48EYLwPDawYVu4dkSHL6dH6ErfcqlMlFMt/tuB ipKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1qy1ehuMKKCWm1G1WSfmQro5ZwGTCo11Wuc7b8opMu4=; b=G/qs/OHxvsTUXStY8idvdjTf4NqalQLfvhpL9ge2Kwi8KBFQfSKnvP5UCHflbQ6PR2 d0OUUAzYzzmYJZx8h7TvbPYz1UbAKLe6ydkwtz2dUPvxsRNmxcd+GwFCxfOhfXz+zdNp HEHy67ispZkmawDwmaw02UoKF+mkar/zEcIAbN2RJJBw7fHxB3he75jakc5HeA5+TJT5 oUViIa8Y/uFftFk9M/cdNbP1x8Gi7uryqzLVj+qUMXCJas6tLIbDKW2tAI5tBweacXEz ao0V6DyeWqsqXe30yrRjQr+iAcj7kzuq7qxybg1O0A4A/DH5sj9kKhkjyW4quDmgmckr zGoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LDIxyA9z; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k128si2715068oih.274.2020.02.06.10.59.08; Thu, 06 Feb 2020 10:59:23 -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=@redhat.com header.s=mimecast20190719 header.b=LDIxyA9z; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbgBFS6I (ORCPT + 99 others); Thu, 6 Feb 2020 13:58:08 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31171 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726990AbgBFS6I (ORCPT ); Thu, 6 Feb 2020 13:58:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581015486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1qy1ehuMKKCWm1G1WSfmQro5ZwGTCo11Wuc7b8opMu4=; b=LDIxyA9z3XGKk+dVZfjdzHqAn6GVZ50O0yj5FUkjQe9eHNHtJ8A22KrLMWDou20tAJtQW8 22I6tyT9Wn/FCnXnBL1woPTD0s0qxG0MkRbUHPqtvD/KkNRBCED0nrGP7LlLDpRqgxomdS r29UNPH11rSsEoT8xUw74OLSB5pbeEY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-210-z-VIY5E5Oa6JUmf70H_-SQ-1; Thu, 06 Feb 2020 13:58:02 -0500 X-MC-Unique: z-VIY5E5Oa6JUmf70H_-SQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E7F5184AEAB; Thu, 6 Feb 2020 18:58:01 +0000 (UTC) Received: from krava (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A9725DA7D; Thu, 6 Feb 2020 18:57:57 +0000 (UTC) Date: Thu, 6 Feb 2020 19:57:54 +0100 From: Jiri Olsa To: Sam Lunt Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, trivial@kernel.org Subject: Re: [PATCH] perf: Support Python 3.8+ in Makefile Message-ID: <20200206185754.GB1669706@krava> References: <20200131181123.tmamivhq4b7uqasr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200131181123.tmamivhq4b7uqasr@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 12:11:23PM -0600, Sam Lunt wrote: > 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 Acked-by: Jiri Olsa thanks, jirka > --- > 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 >