* [PATCH 1/6] perf script python: Fix export-to-postgresql.py occasional failure
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 2/6] perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Adrian Hunter,
Jiri Olsa, stable, Arnaldo Carvalho de Melo
From: Adrian Hunter <adrian.hunter@intel.com>
Occasional export failures were found to be caused by truncating 64-bit
pointers to 32-bits. Fix by explicitly setting types for all ctype
arguments and results.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20180911114504.28516-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index efcaf6cac2eb..e46f51b17513 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -204,14 +204,23 @@ from ctypes import *
libpq = CDLL("libpq.so.5")
PQconnectdb = libpq.PQconnectdb
PQconnectdb.restype = c_void_p
+PQconnectdb.argtypes = [ c_char_p ]
PQfinish = libpq.PQfinish
+PQfinish.argtypes = [ c_void_p ]
PQstatus = libpq.PQstatus
+PQstatus.restype = c_int
+PQstatus.argtypes = [ c_void_p ]
PQexec = libpq.PQexec
PQexec.restype = c_void_p
+PQexec.argtypes = [ c_void_p, c_char_p ]
PQresultStatus = libpq.PQresultStatus
+PQresultStatus.restype = c_int
+PQresultStatus.argtypes = [ c_void_p ]
PQputCopyData = libpq.PQputCopyData
+PQputCopyData.restype = c_int
PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ]
PQputCopyEnd = libpq.PQputCopyEnd
+PQputCopyEnd.restype = c_int
PQputCopyEnd.argtypes = [ c_void_p, c_void_p ]
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] perf script python: Fix export-to-sqlite.py sample columns
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 1/6] perf script python: Fix export-to-postgresql.py occasional failure Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 3/6] perf report: Don't try to map ip to invalid map Arnaldo Carvalho de Melo
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Adrian Hunter,
Jiri Olsa, stable, Arnaldo Carvalho de Melo
From: Adrian Hunter <adrian.hunter@intel.com>
With the "branches" export option, not all sample columns are exported.
However the unwanted columns are not at the end of the tuple, as assumed
by the code. Fix by taking the first 15 and last 3 values, instead of
the first 18.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20180911114504.28516-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/python/export-to-sqlite.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index f827bf77e9d2..e4bb82c8aba9 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -440,7 +440,11 @@ def branch_type_table(*x):
def sample_table(*x):
if branches:
- bind_exec(sample_query, 18, x)
+ for xx in x[0:15]:
+ sample_query.addBindValue(str(xx))
+ for xx in x[19:22]:
+ sample_query.addBindValue(str(xx))
+ do_query_(sample_query)
else:
bind_exec(sample_query, 22, x)
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] perf report: Don't try to map ip to invalid map
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 1/6] perf script python: Fix export-to-postgresql.py occasional failure Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 2/6] perf script python: Fix export-to-sqlite.py sample columns Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 4/6] perf report: Use the offset address to find inline frames Arnaldo Carvalho de Melo
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Milian Wolff,
Jin Yao, Namhyung Kim, Arnaldo Carvalho de Melo
From: Milian Wolff <milian.wolff@kdab.com>
Fixes a crash when the report encounters an address that could not be
associated with an mmaped region:
#0 0x00005555557bdc4a in callchain_srcline (ip=<error reading variable: Cannot access memory at address 0x38>, sym=0x0, map=0x0) at util/machine.c:2329
#1 unwind_entry (entry=entry@entry=0x7fffffff9180, arg=arg@entry=0x7ffff5642498) at util/machine.c:2329
#2 0x00005555558370af in entry (arg=0x7ffff5642498, cb=0x5555557bdb50 <unwind_entry>, thread=<optimized out>, ip=18446744073709551615) at util/unwind-libunwind-local.c:586
#3 get_entries (ui=ui@entry=0x7fffffff9620, cb=0x5555557bdb50 <unwind_entry>, arg=0x7ffff5642498, max_stack=<optimized out>) at util/unwind-libunwind-local.c:703
#4 0x0000555555837192 in _unwind__get_entries (cb=<optimized out>, arg=<optimized out>, thread=<optimized out>, data=<optimized out>, max_stack=<optimized out>) at util/unwind-libunwind-local.c:725
#5 0x00005555557c310f in thread__resolve_callchain_unwind (max_stack=127, sample=0x7fffffff9830, evsel=0x555555c7b3b0, cursor=0x7ffff5642498, thread=0x555555c7f6f0) at util/machine.c:2351
#6 thread__resolve_callchain (thread=0x555555c7f6f0, cursor=0x7ffff5642498, evsel=0x555555c7b3b0, sample=0x7fffffff9830, parent=0x7fffffff97b8, root_al=0x7fffffff9750, max_stack=127) at util/machine.c:2378
#7 0x00005555557ba4ee in sample__resolve_callchain (sample=<optimized out>, cursor=<optimized out>, parent=parent@entry=0x7fffffff97b8, evsel=<optimized out>, al=al@entry=0x7fffffff9750,
max_stack=<optimized out>) at util/callchain.c:1085
Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Tested-by: Sandipan Das <sandipan@linux.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 2a9d5050dc84 ("perf script: Show correct offsets for DWARF-based unwinding")
Link: http://lkml.kernel.org/r/20180926135207.30263-1-milian.wolff@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index c4acd2001db0..0cb4f8bf3ca7 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2312,7 +2312,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
{
struct callchain_cursor *cursor = arg;
const char *srcline = NULL;
- u64 addr;
+ u64 addr = entry->ip;
if (symbol_conf.hide_unresolved && entry->sym == NULL)
return 0;
@@ -2324,7 +2324,8 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
* Convert entry->ip from a virtual address to an offset in
* its corresponding binary.
*/
- addr = map__map_ip(entry->map, entry->ip);
+ if (entry->map)
+ addr = map__map_ip(entry->map, entry->ip);
srcline = callchain_srcline(entry->map, entry->sym, addr);
return callchain_cursor_append(cursor, entry->ip,
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] perf report: Use the offset address to find inline frames
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2018-09-28 12:25 ` [PATCH 3/6] perf report: Don't try to map ip to invalid map Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
2018-10-01 5:42 ` Ravi Bangoria
2018-09-28 12:25 ` [PATCH 5/6] perf report: Don't crash on invalid inline debug information Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 6/6] perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Arnaldo Carvalho de Melo
5 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Milian Wolff,
Jin Yao, Namhyung Kim, Sandipan Das, Arnaldo Carvalho de Melo
From: Milian Wolff <milian.wolff@kdab.com>
To correctly find inlined frames, we have to use the file offset instead
of the virtual memory address. This was already fixed for displaying
srcline information while displaying in commit 2a9d5050dc84fa20 ("perf
script: Show correct offsets for DWARF-based unwinding"). We just need
to use the same corrected address also when trying to find inline
frames.
This is another follow-up to commit 19610184693c ("perf script: Show
virtual addresses instead of offsets").
Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Sandipan Das <sandipan@linux.ibm.com>
Fixes: 19610184693c ("perf script: Show virtual addresses instead of offsets")
Link: http://lkml.kernel.org/r/20180926135207.30263-2-milian.wolff@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 0cb4f8bf3ca7..73a651f10a0f 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2317,9 +2317,6 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
if (symbol_conf.hide_unresolved && entry->sym == NULL)
return 0;
- if (append_inlines(cursor, entry->map, entry->sym, entry->ip) == 0)
- return 0;
-
/*
* Convert entry->ip from a virtual address to an offset in
* its corresponding binary.
@@ -2327,6 +2324,9 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
if (entry->map)
addr = map__map_ip(entry->map, entry->ip);
+ if (append_inlines(cursor, entry->map, entry->sym, addr) == 0)
+ return 0;
+
srcline = callchain_srcline(entry->map, entry->sym, addr);
return callchain_cursor_append(cursor, entry->ip,
entry->map, entry->sym,
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/6] perf report: Use the offset address to find inline frames
2018-09-28 12:25 ` [PATCH 4/6] perf report: Use the offset address to find inline frames Arnaldo Carvalho de Melo
@ 2018-10-01 5:42 ` Ravi Bangoria
0 siblings, 0 replies; 8+ messages in thread
From: Ravi Bangoria @ 2018-10-01 5:42 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar, Milian Wolff
Cc: Clark Williams, linux-kernel, linux-perf-users, Jin Yao,
Namhyung Kim, Sandipan Das, Arnaldo Carvalho de Melo,
Ravi Bangoria
Hi Milian,
Seems this has a regression:
With acme/perf/urgent:
$ ./perf record -e cycles:u --call-graph=dwarf ls
$ ./perf script
ls 13585 602082.534478: 28032 cycles:u:
1f1f4 __GI___tunables_init+0xffff0000d3dc00a4 (/usr/lib64/ld-2.26.so)
20e2b _dl_sysdep_start+0xffff0000d3dc04ab (/usr/lib64/ld-2.26.so)
1ca7 _dl_start_final+0xffff0000d3dc00f7 (/usr/lib64/ld-2.26.so)
29b3 _dl_start+0xffff0000d3dc0553 (/usr/lib64/ld-2.26.so)
1437 _start+0xffff0000d3dc0017 (/usr/lib64/ld-2.26.so)
After reverting this patch:
$ git revert d9c910d5f8c3a1858f115dc9d3b157df32da70a3
[a/perf/urgent 72cada4e6b30] Revert "perf report: Use the offset address to find inline frames"
$ ./perf script
ls 13585 602082.534478: 28032 cycles:u:
7fff9613f1f4 __GI___tunables_init+0xa4 (/usr/lib64/ld-2.26.so)
7fff96140e2b _dl_sysdep_start+0x4ab (/usr/lib64/ld-2.26.so)
7fff96121ca7 _dl_start_final+0xf7 (/usr/lib64/ld-2.26.so)
7fff961229b3 _dl_start+0x553 (/usr/lib64/ld-2.26.so)
7fff96121437 _start+0x17 (/usr/lib64/ld-2.26.so)
Thanks,
Ravi
On 09/28/2018 05:55 PM, Arnaldo Carvalho de Melo wrote:
> From: Milian Wolff <milian.wolff@kdab.com>
>
> To correctly find inlined frames, we have to use the file offset instead
> of the virtual memory address. This was already fixed for displaying
> srcline information while displaying in commit 2a9d5050dc84fa20 ("perf
> script: Show correct offsets for DWARF-based unwinding"). We just need
> to use the same corrected address also when trying to find inline
> frames.
>
> This is another follow-up to commit 19610184693c ("perf script: Show
> virtual addresses instead of offsets").
>
> Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
> Cc: Jin Yao <yao.jin@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Sandipan Das <sandipan@linux.ibm.com>
> Fixes: 19610184693c ("perf script: Show virtual addresses instead of offsets")
> Link: http://lkml.kernel.org/r/20180926135207.30263-2-milian.wolff@kdab.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/util/machine.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 0cb4f8bf3ca7..73a651f10a0f 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2317,9 +2317,6 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
> if (symbol_conf.hide_unresolved && entry->sym == NULL)
> return 0;
>
> - if (append_inlines(cursor, entry->map, entry->sym, entry->ip) == 0)
> - return 0;
> -
> /*
> * Convert entry->ip from a virtual address to an offset in
> * its corresponding binary.
> @@ -2327,6 +2324,9 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
> if (entry->map)
> addr = map__map_ip(entry->map, entry->ip);
>
> + if (append_inlines(cursor, entry->map, entry->sym, addr) == 0)
> + return 0;
> +
> srcline = callchain_srcline(entry->map, entry->sym, addr);
> return callchain_cursor_append(cursor, entry->ip,
> entry->map, entry->sym,
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/6] perf report: Don't crash on invalid inline debug information
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2018-09-28 12:25 ` [PATCH 4/6] perf report: Use the offset address to find inline frames Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
2018-09-28 12:25 ` [PATCH 6/6] perf python: Use -Wno-redundant-decls to build with PYTHON=python3 Arnaldo Carvalho de Melo
5 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users, Milian Wolff,
Jin Yao, Jiri Olsa, Namhyung Kim, Arnaldo Carvalho de Melo
From: Milian Wolff <milian.wolff@kdab.com>
When the function name for an inline frame is invalid, we must not try
to demangle this symbol, otherwise we crash with:
#0 0x0000555555895c01 in bfd_demangle ()
#1 0x0000555555823262 in demangle_sym (dso=0x555555d92b90, elf_name=0x0, kmodule=0) at util/symbol-elf.c:215
#2 dso__demangle_sym (dso=dso@entry=0x555555d92b90, kmodule=<optimized out>, kmodule@entry=0, elf_name=elf_name@entry=0x0) at util/symbol-elf.c:400
#3 0x00005555557fef4b in new_inline_sym (funcname=0x0, base_sym=0x555555d92b90, dso=0x555555d92b90) at util/srcline.c:89
#4 inline_list__append_dso_a2l (dso=dso@entry=0x555555c7bb00, node=node@entry=0x555555e31810, sym=sym@entry=0x555555d92b90) at util/srcline.c:264
#5 0x00005555557ff27f in addr2line (dso_name=dso_name@entry=0x555555d92430 "/home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf", addr=addr@entry=2888, file=file@entry=0x0,
line=line@entry=0x0, dso=dso@entry=0x555555c7bb00, unwind_inlines=unwind_inlines@entry=true, node=0x555555e31810, sym=0x555555d92b90) at util/srcline.c:313
#6 0x00005555557ffe7c in addr2inlines (sym=0x555555d92b90, dso=0x555555c7bb00, addr=2888, dso_name=0x555555d92430 "/home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf")
at util/srcline.c:358
So instead handle the case where we get invalid function names for
inlined frames and use a fallback '??' function name instead.
While this crash was originally reported by Hadrien for rust code, I can
now also reproduce it with trivial C++ code. Indeed, it seems like
libbfd fails to interpret the debug information for the inline frame
symbol name:
$ addr2line -e /home/milian/.debug/.build-id/f7/186d14bb94f3c6161c010926da66033d24fce5/elf -if b48
main
/usr/include/c++/8.2.1/complex:610
??
/usr/include/c++/8.2.1/complex:618
??
/usr/include/c++/8.2.1/complex:675
??
/usr/include/c++/8.2.1/complex:685
main
/home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39
I've reported this bug upstream and also attached a patch there which
should fix this issue:
https://sourceware.org/bugzilla/show_bug.cgi?id=23715
Reported-by: Hadrien Grasland <grasland@lal.in2p3.fr>
Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20180926135207.30263-3-milian.wolff@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/srcline.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 09d6746e6ec8..e767c4a9d4d2 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -85,6 +85,9 @@ static struct symbol *new_inline_sym(struct dso *dso,
struct symbol *inline_sym;
char *demangled = NULL;
+ if (!funcname)
+ funcname = "??";
+
if (dso) {
demangled = dso__demangle_sym(dso, 0, funcname);
if (demangled)
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] perf python: Use -Wno-redundant-decls to build with PYTHON=python3
2018-09-28 12:25 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2018-09-28 12:25 ` [PATCH 5/6] perf report: Don't crash on invalid inline debug information Arnaldo Carvalho de Melo
@ 2018-09-28 12:25 ` Arnaldo Carvalho de Melo
5 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-09-28 12:25 UTC (permalink / raw)
To: Ingo Molnar
Cc: Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo, Adrian Hunter, David Ahern, Jiri Olsa,
Namhyung Kim, Thiago Macieira, Wang Nan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
When building in ClearLinux using 'make PYTHON=python3' with gcc 8.2.1
it fails with:
GEN /tmp/build/perf/python/perf.so
In file included from /usr/include/python3.7m/Python.h:126,
from /git/linux/tools/perf/util/python.c:2:
/usr/include/python3.7m/import.h:58:24: error: redundant redeclaration of ‘_PyImport_AddModuleObject’ [-Werror=redundant-decls]
PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.7m/import.h:47:24: note: previous declaration of ‘_PyImport_AddModuleObject’ was here
PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1
And indeed there is a redundant declaration in that Python.h file, one
with parameter names and the other without, so just add
-Wno-error=redundant-decls to the python setup instructions.
Now perf builds with gcc in ClearLinux with the following Dockerfile:
# docker.io/acmel/linux-perf-tools-build-clearlinux:latest
FROM docker.io/clearlinux:latest
MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
RUN swupd update && \
swupd bundle-add sysadmin-basic-dev
RUN mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux && \
groupadd -r perfbuilder && \
useradd -m -r -g perfbuilder perfbuilder && \
chown -R perfbuilder.perfbuilder /tmp/build/ /git/
USER perfbuilder
COPY rx_and_build.sh /
ENV EXTRA_MAKE_ARGS=PYTHON=python3
ENTRYPOINT ["/rx_and_build.sh"]
Now to figure out why the build fails with clang, that is present in the
above container as detected by the rx_and_build.sh script:
clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/sbin
make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
HOSTCC /tmp/build/perf/fixdep.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ OFF ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ OFF ]
Makefile.config:331: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop.
make[1]: *** [Makefile.perf:206: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/git/linux/tools/perf'
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: Thiago Macieira <thiago.macieira@intel.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-c3khb9ac86s00qxzjrueomme@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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 97efbcad076e..1942f6dd24f6 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -35,7 +35,7 @@ class install_lib(_install_lib):
cflags = getenv('CFLAGS', '').split()
# switch off several checks (need to be at the end of cflags list)
-cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
+cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ]
if cc != "clang":
cflags += ['-Wno-cast-function-type' ]
--
2.14.4
^ permalink raw reply related [flat|nested] 8+ messages in thread