File tools-build-Remove-needless-libpython-version-feature-check-that-breaks-test-all-fast-path.patch of Package perf
194
1
From: Arnaldo Carvalho de Melo <acme@redhat.com>
2
Date: Tue, 30 Nov 2021 10:12:41 -0300
3
Subject: tools build: Remove needless libpython-version feature check that
4
breaks test-all fast path
5
MIME-Version: 1.0
6
Content-Type: text/plain; charset=UTF-8
7
Content-Transfer-Encoding: 8bit
8
Git-commit: 3d1d57debee2d342a47615707588b96658fabb85
9
Patch-mainline: v5.16-rc5
10
References: git-fixes
11
12
Since 66dfdff03d196e51 ("perf tools: Add Python 3 support") we don't use
13
the tools/build/feature/test-libpython-version.c version in any Makefile
14
feature check:
15
16
$ find tools/ -type f | xargs grep feature-libpython-version
17
$
18
19
The only place where this was used was removed in 66dfdff03d196e51:
20
21
- ifneq ($(feature-libpython-version), 1)
22
- $(warning Python 3 is not yet supported; please set)
23
- $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
24
- $(warning If you also have Python 2 installed, then)
25
- $(warning try something like:)
26
- $(warning $(and ,))
27
- $(warning $(and ,) make PYTHON=python2)
28
- $(warning $(and ,))
29
- $(warning Otherwise, disable Python support entirely:)
30
- $(warning $(and ,))
31
- $(warning $(and ,) make NO_LIBPYTHON=1)
32
- $(warning $(and ,))
33
- $(error $(and ,))
34
- else
35
- LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
36
- EXTLIBS += $(PYTHON_EMBED_LIBADD)
37
- LANG_BINDINGS += $(obj-perf)python/perf.so
38
- $(call detected,CONFIG_LIBPYTHON)
39
- endif
40
41
And nowadays we either build with PYTHON=python3 or just install the
42
python3 devel packages and perf will build against it.
43
44
But the leftover feature-libpython-version check made the fast path
45
feature detection to break in all cases except when python2 devel files
46
were installed:
47
48
$ rpm -qa | grep python.*devel
49
python3-devel-3.9.7-1.fc34.x86_64
50
$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
51
$ make -C tools/perf O=/tmp/build/perf install-bin
52
make: Entering directory '/var/home/acme/git/perf/tools/perf'
53
BUILD: Doing 'make -j32' parallel build
54
HOSTCC /tmp/build/perf/fixdep.o
55
<SNIP>
56
$ cat /tmp/build/perf/feature/test-all.make.output
57
In file included from test-all.c:18:
58
test-libpython-version.c:5:10: error: #error
59
5 | #error
60
| ^~~~~
61
$ ldd ~/bin/perf | grep python
62
libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007fda6dbcf000)
63
$
64
65
As python3 is the norm these days, fix this by just removing the unused
66
feature-libpython-version feature check, making the test-all fast path
67
to work with the common case.
68
69
With this:
70
71
$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
72
$ make -C tools/perf O=/tmp/build/perf install-bin |& head
73
make: Entering directory '/var/home/acme/git/perf/tools/perf'
74
BUILD: Doing 'make -j32' parallel build
75
HOSTCC /tmp/build/perf/fixdep.o
76
HOSTLD /tmp/build/perf/fixdep-in.o
77
LINK /tmp/build/perf/fixdep
78
79
Auto-detecting system features:
80
... dwarf: [ on ]
81
... dwarf_getlocations: [ on ]
82
... glibc: [ on ]
83
$ ldd ~/bin/perf | grep python
84
libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007f58800b0000)
85
$ cat /tmp/build/perf/feature/test-all.make.output
86
$
87
88
Reviewed-by: James Clark <james.clark@arm.com>
89
Fixes: 66dfdff03d196e51 ("perf tools: Add Python 3 support")
90
Cc: Adrian Hunter <adrian.hunter@intel.com>
91
Cc: Ian Rogers <irogers@google.com>
92
Cc: Jaroslav Škarvada <jskarvad@redhat.com>
93
Cc: Jiri Olsa <jolsa@kernel.org>
94
Cc: Namhyung Kim <namhyung@kernel.org>
95
Link: https://lore.kernel.org/lkml/YaYmeeC6CS2b8OSz@kernel.org
96
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
97
Signed-off-by: Tony Jones <tonyj@suse.de>
98
---
99
tools/build/Makefile.feature | 1 -
100
tools/build/feature/Makefile | 4 ----
101
tools/build/feature/test-all.c | 5 -----
102
tools/build/feature/test-libpython-version.c | 11 -----------
103
tools/perf/Makefile.config | 2 --
104
5 files changed, 23 deletions(-)
105
106
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
107
index 45a9a59828c3..ae61f464043a 100644
108
--- a/tools/build/Makefile.feature
109
+++ b/tools/build/Makefile.feature
110
111
numa_num_possible_cpus \
112
libperl \
113
libpython \
114
- libpython-version \
115
libslang \
116
libslang-include-subdir \
117
libtraceevent \
118
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
119
index 0a3244ad9673..1480910c792e 100644
120
--- a/tools/build/feature/Makefile
121
+++ b/tools/build/feature/Makefile
122
123
test-numa_num_possible_cpus.bin \
124
test-libperl.bin \
125
test-libpython.bin \
126
- test-libpython-version.bin \
127
test-libslang.bin \
128
test-libslang-include-subdir.bin \
129
test-libtraceevent.bin \
130
131
$(OUTPUT)test-libpython.bin:
132
$(BUILD) $(FLAGS_PYTHON_EMBED)
133
134
-$(OUTPUT)test-libpython-version.bin:
135
- $(BUILD)
136
-
137
$(OUTPUT)test-libbfd.bin:
138
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
139
140
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
141
index 0b243ce842be..5ffafb967b6e 100644
142
--- a/tools/build/feature/test-all.c
143
+++ b/tools/build/feature/test-all.c
144
145
# include "test-libpython.c"
146
#undef main
147
148
-#define main main_test_libpython_version
149
-# include "test-libpython-version.c"
150
-#undef main
151
-
152
#define main main_test_libperl
153
# include "test-libperl.c"
154
#undef main
155
156
int main(int argc, char *argv[])
157
{
158
main_test_libpython();
159
- main_test_libpython_version();
160
main_test_libperl();
161
main_test_hello();
162
main_test_libelf();
163
diff --git a/tools/build/feature/test-libpython-version.c b/tools/build/feature/test-libpython-version.c
164
deleted file mode 100644
165
index 47714b942d4d..000000000000
166
--- a/tools/build/feature/test-libpython-version.c
167
+++ /dev/null
168
169
-// SPDX-License-Identifier: GPL-2.0
170
-#include <Python.h>
171
-
172
-#if PY_VERSION_HEX >= 0x03000000
173
- #error
174
-#endif
175
-
176
-int main(void)
177
-{
178
- return 0;
179
-}
180
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
181
index afd144725a0b..3df74cf5651a 100644
182
--- a/tools/perf/Makefile.config
183
+++ b/tools/perf/Makefile.config
184
185
186
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
187
FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
188
-FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
189
-FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
190
191
FEATURE_CHECK_LDFLAGS-libaio = -lrt
192
193
194