Skip to content

Commit cfff2d9

Browse files
committed
perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5
PyVarObject_HEAD_INIT is undefined in python 2.5, resulting in a build crash: util/python.c:81: attention : déclaration implicite de la fonction « «PyVarObject_HEAD_INIT» » util/python.c:82: erreur: request for member «tp_name» in something not a structure or union util/python.c:117: erreur: request for member «tp_name» in something not a structure or union util/python.c:146: erreur: request for member «tp_name» in something not a structure or union util/python.c:177: erreur: request for member «tp_name» in something not a structure or union util/python.c:290: erreur: request for member «tp_name» in something not a structure or union util/python.c:359: erreur: request for member «tp_name» in something not a structure or union util/python.c:532: erreur: request for member «tp_name» in something not a structure or union util/python.c:761: erreur: request for member «tp_name» in something not a structure or union error: command 'gcc' failed with exit status 1 make: *** [python/perf.so] Erreur 1 We can fix that by defining PyVarObject_HEAD_INIT as a wrapper on PyObject_HEAD_INIT, thanks to a trick found on biopython: biopython/biopython@d4eaf57 Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent ff9ae1b commit cfff2d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/perf/util/python.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#include "cpumap.h"
99
#include "thread_map.h"
1010

11+
/* Define PyVarObject_HEAD_INIT for python 2.5 */
12+
#ifndef PyVarObject_HEAD_INIT
13+
# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
14+
#endif
15+
1116
struct throttle_event {
1217
struct perf_event_header header;
1318
u64 time;

0 commit comments

Comments
 (0)