Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1340282ybb; Sat, 4 Apr 2020 01:42:24 -0700 (PDT) X-Google-Smtp-Source: APiQypIDE0XaY1dGmmRXAtxyansTIa3wt8bFkC86Jh2DoE03rIszWydhfgctpKvRljn4BQCAY4Ne X-Received: by 2002:a05:6830:1d67:: with SMTP id l7mr9463874oti.72.1585989744469; Sat, 04 Apr 2020 01:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585989744; cv=none; d=google.com; s=arc-20160816; b=oGfzMSfklTVkMHPeQ3IE+/JKFYid5oHDIT5aZTWR5kpWwR+ywqhb/Xh9bf8YnUpW4A grapHsJl7MNj0nwS805c6r+FVQR9xfznlNl5XBBPZLHl9VnpCDb5r6o3rm5ODPVaRnO7 k9aI8IHoSAofXxX7gzJXV6WYscHZz1HFqCi11VITdBexHk5/GDA7lbmnWZ0N1gxt2vqY PtJAUTxjydlZzOAjw6YLRANK+Iem0IU9e+az2IFYb/DxuUnW3t03SS5k8dE2YgfA/8pA PN6uaOPC3d54aSv4ZfLC5Q4+tg97lEw+t/ZjOxvzNvTGNKYIdbMy+4Twb7hbqYnU1gw/ 04Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=NB9NoGS8fQmoqBsGVuAnD7vOOTuaCeevvaZtt7Nn8jU=; b=CdOVQgHqLbCwNNDf09UGHVtzRsgQ0LevYIf7qDMhhmMVEgE78EgDG0v8VcvnFx76mI A9vw/APeaWnxsRoj54v4ILfPrVdY24WUucUKUigvb02TixbVws3ff2v9DDXa2t+jEtQq F9QV6NupdMLJA4d5dYUlG8zw8ZItpY2j/+gB/4/m6j0A7/1f28kcVOT2KWtlmhTqNqV/ RzM16lYcBqpSWwVlJmjFYcNHMtefVGbUvs2HzyYsfNOAykSV5gT+Cdhn5JF6lbD4XIrS WO1WuD17NMY5hF9ObRM9l5Y8ADjUWmC4ZcuJkdroYLErQCOHr+KZd5ZPyYounsWYFTI3 F10w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f26si5224267otc.182.2020.04.04.01.42.11; Sat, 04 Apr 2020 01:42:24 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgDDIlu convert rfc822-to-8bit (ORCPT + 99 others); Sat, 4 Apr 2020 04:41:50 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41398 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbgDDIlt (ORCPT ); Sat, 4 Apr 2020 04:41:49 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jKeN1-0000uP-NH; Sat, 04 Apr 2020 10:41:39 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 049901C0243; Sat, 4 Apr 2020 10:41:39 +0200 (CEST) Date: Sat, 04 Apr 2020 08:41:38 -0000 From: "tip-bot2 for Arnaldo Carvalho de Melo" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf python: Fix clang detection to strip out options passed in $CC Cc: daniel.diaz@linaro.org, Naresh Kamboju , Adrian Hunter , Ilie Halip , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200401124037.GA12534@kernel.org> References: <20200401124037.GA12534@kernel.org> MIME-Version: 1.0 Message-ID: <158598969854.28353.7275617434377208248.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 9ff76cea4e9e6d49a6f764ae114fc0fb8de97816 Gitweb: https://git.kernel.org/tip/9ff76cea4e9e6d49a6f764ae114fc0fb8de97816 Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 01 Apr 2020 09:33:59 -03:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Fri, 03 Apr 2020 10:04:59 -03:00 perf python: Fix clang detection to strip out options passed in $CC The clang check in the python setup.py file expected $CC to be just the name of the compiler, not the compiler + options, i.e. all options were expected to be passed in $CFLAGS, this ends up making it fail in systems where CC is set to, e.g.: "aarch64-linaro-linux-gcc --sysroot=/oe/build/tmp/work/juno-linaro-linux/perf/1.0-r9/recipe-sysroot" Like this: $ python3 >>> from subprocess import Popen >>> a = Popen(["aarch64-linux-gnu-gcc --sysroot=/oe/build/tmp/work/juno-linaro-linux/perf/1.0-r9/recipe-sysroot", "-v"]) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'aarch64-linux-gnu-gcc --sysroot=/oe/build/tmp/work/juno-linaro-linux/perf/1.0-r9/recipe-sysroot': 'aarch64-linux-gnu-gcc --sysroot=/oe/build/tmp/work/juno-linaro-linux/perf/1.0-r9/recipe-sysroot' >>> Make it more robust, covering this case, by passing cc.split()[0] as the first arg to popen(). Fixes: a7ffd416d804 ("perf python: Fix clang detection when using CC=clang-version") Reported-by: Daniel Díaz Reported-by: Naresh Kamboju Tested-by: Daniel Díaz Cc: Adrian Hunter Cc: Ilie Halip Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/20200401124037.GA12534@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 8a065a6..347b2c0 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -3,7 +3,7 @@ from subprocess import Popen, PIPE from re import sub cc = getenv("CC") -cc_is_clang = b"clang version" in Popen([cc, "-v"], stderr=PIPE).stderr.readline() +cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline() def clang_has_option(option): return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ]