Re: [PATCH 2/3] perf build: Use libtraceevent from the system

Arnaldo Carvalho de Melo
2022-12-12T14:40:21Z

Hi,

Just added this to the mix to fix a the python binding:

diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 34fceda3af3a9b26..e80ffbbfacfb8cc0 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -63,15 +63,18 @@ libperf = getenv('LIBPERF')
ext_sources = [f.strip() for f in open('util/python-ext-sources')
if len(f.strip()) > 0 and f[0] != '#']

-if not '-DHAVE_LIBTRACEEVENT' in cflags:
+extra_libraries = []
+
+if '-DHAVE_LIBTRACEEVENT' in cflags:
+ extra_libraries += [ 'traceevent' ]
+else:
ext_sources.remove('util/trace-event.c')

# use full paths with source files
ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources))

-extra_libraries = []
if '-DHAVE_LIBNUMA_SUPPORT' in cflags:
- extra_libraries = [ 'numa' ]
+ extra_libraries += [ 'numa' ]
if '-DHAVE_LIBCAP_SUPPORT' in cflags:
extra_libraries += [ 'cap' ]

⬢[acme@toolbox perf]$ ldd /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007fffa59f8000)
libunwind-x86_64.so.8 => /lib64/libunwind-x86_64.so.8 (0x00007fb4fde98000)
libunwind.so.8 => /lib64/libunwind.so.8 (0x00007fb4fde7f000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fb4fde54000)
libtraceevent.so.1 => /lib64/libtraceevent.so.1 (0x00007fb4fde2e000)
libnuma.so.1 => /lib64/libnuma.so.1 (0x00007fb4fde20000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fb4fde16000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb4fdc00000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb4fdbe0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb4fdf13000)
⬢[acme@toolbox perf]$ perf test python
19: 'import perf' in python : Ok
⬢[acme@toolbox perf]$