All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 02/18] perf python: Filter out -specs=/a/b/c from the python binding cc options
Date: Mon, 20 Feb 2017 16:08:23 -0300	[thread overview]
Message-ID: <20170220190839.3928-3-acme@kernel.org> (raw)
In-Reply-To: <20170220190839.3928-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The -spec=/path/to/file can be used to change what gcc puts in the cc,
ld, etc command lines, but this is not present in clang, filter it out
at the setup.py file by changing python2's internal variable where it
keeps its initial CFLAGS value.

With this all of perf can be built in at least Fedora 25, fixing this
problem:

    GEN      /tmp/build/perf/python/perf.so
    CC       /tmp/build/perf/builtin-buildid-list.o
  clang-4.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
  clang-4.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
  error: command 'clang' failed with exit status 1

Now I need to change all the containers where I have clang to build
perf with it, so that we can check that in other distros (opensuse, debian,
ubuntu, etc) this also works.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-g9lhgr162ao8ao29vvf0hgm1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/setup.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index c8680984d2d6..af415febbc46 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -1,8 +1,15 @@
 #!/usr/bin/python2
 
-from distutils.core import setup, Extension
 from os import getenv
 
+cc = getenv("CC")
+if cc == "clang":
+    from _sysconfigdata import build_time_vars
+    from re import sub
+    build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"])
+
+from distutils.core import setup, Extension
+
 from distutils.command.build_ext   import build_ext   as _build_ext
 from distutils.command.install_lib import install_lib as _install_lib
 
-- 
2.9.3

  parent reply	other threads:[~2017-02-20 19:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 19:08 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 01/18] tools perf scripting python: clang doesn't have -spec, remove it Arnaldo Carvalho de Melo
2017-02-20 19:08 ` Arnaldo Carvalho de Melo [this message]
2017-02-20 19:08 ` [PATCH 03/18] tools lib traceevent: It's preempt not prempt Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 04/18] perf session: Fix DEBUG=1 build with clang Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 05/18] perf cpumap: Add cpu__max_present_cpu() Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 06/18] perf header: Make build_cpu_topology skip offline/absent CPUs Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 07/18] perf tools: Replace _SC_NPROCESSORS_CONF with max_present_cpu in cpu_topology_map Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 08/18] perf build: Add special fixdep cleaning rule Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 09/18] perf tools: Move new_term arguments into struct parse_events_term template Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 10/18] perf tools: Fail on using multiple bits long terms without value Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 11/18] perf stat: Add -a as default target Arnaldo Carvalho de Melo
2017-02-20 19:15   ` Borislav Petkov
2017-02-20 19:55     ` Arnaldo Carvalho de Melo
2017-02-20 19:59       ` Borislav Petkov
2017-02-21  7:49         ` Jiri Olsa
2017-02-20 19:08 ` [PATCH 12/18] perf record: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 13/18] perf utils: Add perf_quiet_option() Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 14/18] perf utils: Check verbose flag properly Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 15/18] perf report: Add -q/--quiet option Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 16/18] perf diff: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 17/18] perf annotate: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 18/18] perf record: Honor --quiet option properly Arnaldo Carvalho de Melo
2017-02-21  8:08 ` [GIT PULL 00/18] perf/core improvements and fixes Ingo Molnar

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=20170220190839.3928-3-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --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.