IGT command line tools load redundant GUI libraries
Submitted by Eero Tamminen
Assigned to Default DRI bug account
Link to original bug (#110249)
Description
IGT command line tools load many unnecessary libraries, because they use libigt.so which links in a huge amount of libraries:
$ ldd libigt.so
linux-vdso.so.1 (0x00007ffdf24d6000)
libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f8d5daa4000)
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f8d5d78e000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f8d5d57d000)
libdw.so.1 => /usr/lib/x86_64-linux-gnu/libdw.so.1 (0x00007f8d5d331000)
libkmod.so.2 => /lib/x86_64-linux-gnu/libkmod.so.2 (0x00007f8d5d11a000)
libprocps.so.6 => /lib/x86_64-linux-gnu/libprocps.so.6 (0x00007f8d5cef6000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f8d5ccd8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d5c93a000)
libpciaccess.so.0 => /usr/lib/x86_64-linux-gnu/libpciaccess.so.0 (0x00007f8d5c731000)
libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f8d5c48c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d5c284000)
libdrm_intel.so.1 => /usr/lib/x86_64-linux-gnu/libdrm_intel.so.1 (0x00007f8d5c061000)
libunwind.so.8 => /usr/lib/x86_64-linux-gnu/libunwind.so.8 (0x00007f8d5be46000)
libgsl.so.23 => /usr/lib/x86_64-linux-gnu/libgsl.so.23 (0x00007f8d5b9e4000)
libgslcblas.so.0 => /usr/lib/x86_64-linux-gnu/libgslcblas.so.0 (0x00007f8d5b7a5000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f8d5b49e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8d5b27f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d5ae8e000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f8d5ac49000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f8d5a995000)
libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f8d5a763000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f8d5a560000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f8d5a338000)
libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f8d5a12b000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f8d59f21000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f8d59be9000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f8d599d7000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8d597ba000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8d59548000)
libelf.so.1 => /usr/lib/x86_64-linux-gnu/libelf.so.1 (0x00007f8d5932e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d5912a000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8d58f04000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f8d58cf4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8d5e035000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f8d58a70000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f8d5883e000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f8d5863a000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f8d58434000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f8d58218000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f8d57efd000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f8d57ce8000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f8d57ad3000)
For example "intel_gpu_top" seems to need just these symbols from it:
$ readelf -s intel_gpu_top |grep igt
10: 0000000000000000 0 FUNC GLOBAL DEFAULT UND igt_perf_open_group
28: 0000000000000000 0 FUNC GLOBAL DEFAULT UND igt_perf_open
58: 00000000002060a0 200 OBJECT GLOBAL DEFAULT 25 igt_subtest_jmpbuf
113: 0000000000000000 0 FUNC GLOBAL DEFAULT UND igt_perf_open_group
124: 00000000002060a0 200 OBJECT GLOBAL DEFAULT 25 igt_subtest_jmpbuf
139: 0000000000000000 0 FUNC GLOBAL DEFAULT UND igt_perf_open
And sone other functions it needs are some json and printing helpers + normal libc stuff. It does NOT need freetype, pixman, Cairo, ALSA sound, X11 libraries, libglsl etc stuff brought in by libigt.
It's annoying to need to install these redundant dependencies on e.g. headless media transcoding server if one just wants to use intel_gpu_top to monitor GPU utilization.
Wouldn't it make sense to split libigt up a bit, e.g. to GUI and non-GUI bits?