bsc-performance-tools / wxparaver

wxParaver is a trace-based visualization and analysis tool designed to study quantitative detailed metrics and obtain qualitative knowledge of the performance of applications, libraries, processors and whole architectures.
http://tools.bsc.es/paraver
GNU Lesser General Public License v2.1
26 stars 3 forks source link

wxparaver.bin: symbol lookup error: /usr/lib/libtiff.so.6: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0 #12

Open rodarima opened 10 months ago

rodarima commented 10 months ago

Hi,

The last binary relase of wxparaver (4.11.2) doesn't work in Arch Linux:

hop% wxparaver-4.11.2-Linux_x86_64/bin/wxparaver
/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/bin/wxparaver.bin: symbol lookup error: /usr/lib/libtiff.so.6: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0

The problem can be traced with LD_DEBUG=libs,files (or LD_DEBUG=all with much more detail), where there are two versions of libtiff being loaded at the same time. One is requested by paraver via lib64/wxparaver/libwx_gtk2u_propgrid-3.0.so.0 and is loaded from the bundled libs:

    644114:     file=libtiff.so.5 [0];  needed by /home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libwx_gtk2u_propgrid-3.0.so.0 [0]
    644114:     find library=libtiff.so.5 [0]; searching
    644114:      search path=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel:/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver:glibc-hwcaps/x86-64-v3:glibc-hwcaps/x86-64-v2:              (LD_LIBRARY_PATH)
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel/libtiff.so.5
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libtiff.so.5
    644114:
    644114:     file=libtiff.so.5 [0];  generating link map
    644114:       dynamic: 0x00007f6862667cb0  base: 0x00007f6862400000   size: 0x0000000000268a90
    644114:         entry: 0x00007f6862408d30  phdr: 0x00007f6862400040  phnum:                  7

But another one is requested as a dependency of /usr/lib/libgdk_pixbuf-2.0.so.0 (requested by lib64/wxparaver/libwx_gtk2u_propgrid-3.0.so.0):

    644114:     file=libgdk_pixbuf-2.0.so.0 [0];  needed by /home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libwx_gtk2u_propgrid-3.0.so.0 [0]
    644114:     find library=libgdk_pixbuf-2.0.so.0 [0]; searching
    644114:      search path=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel:/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver:glibc-hwcaps/x86-64-v3:glibc-hwcaps/x86-64-v2:              (LD_LIBRARY_PATH)
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel/libgdk_pixbuf-2.0.so.0
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libgdk_pixbuf-2.0.so.0
    644114:       trying file=glibc-hwcaps/x86-64-v3/libgdk_pixbuf-2.0.so.0
    644114:       trying file=glibc-hwcaps/x86-64-v2/libgdk_pixbuf-2.0.so.0
    644114:       trying file=libgdk_pixbuf-2.0.so.0
    644114:      search cache=/etc/ld.so.cache
    644114:       trying file=/usr/lib/libgdk_pixbuf-2.0.so.0
    644114:
    644114:     file=libgdk_pixbuf-2.0.so.0 [0];  generating link map
    644114:       dynamic: 0x00007f6868b11370  base: 0x00007f6868acd000   size: 0x0000000000045700
    644114:         entry: 0x00007f6868acd000  phdr: 0x00007f6868acd040  phnum:                 11
...

    644114:     file=libtiff.so.6 [0];  needed by /usr/lib/libgdk_pixbuf-2.0.so.0 [0]
    644114:     find library=libtiff.so.6 [0]; searching
    644114:      search path=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel:/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver:glibc-hwcaps/x86-64-v3:glibc-hwcaps/x86-64-v2:              (LD_LIBRARY_PATH)
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel/libtiff.so.6
    644114:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libtiff.so.6
    644114:       trying file=glibc-hwcaps/x86-64-v3/libtiff.so.6
    644114:       trying file=glibc-hwcaps/x86-64-v2/libtiff.so.6
    644114:       trying file=libtiff.so.6
    644114:      search cache=/etc/ld.so.cache
    644114:       trying file=/usr/lib/libtiff.so.6
    644114:
    644114:     file=libtiff.so.6 [0];  generating link map
    644114:       dynamic: 0x00007f68653fe718  base: 0x00007f6865372000   size: 0x000000000008d1e8
    644114:         entry: 0x00007f6865372000  phdr: 0x00007f6865372040  phnum:                 11

But then, the libjpeg symbols of my libtiff library are being resolved from the libjpeg bundled in paraver, which got loaded first:

    650689:     file=libjpeg.so.8 [0];  needed by /home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libwx_gtk2u_propgrid-3.0.so.0 [0]
    650689:     find library=libjpeg.so.8 [0]; searching
    650689:      search path=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel:/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver:glibc-hwcaps/x86-64-v3:glibc-hwcaps/x86-64-v2:              (LD_LIBRARY_PATH)
    650689:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/paraver-kernel/libjpeg.so.8
    650689:       trying file=/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libjpeg.so.8
    650689:
    650689:     file=libjpeg.so.8 [0];  generating link map
    650689:       dynamic: 0x00007f2e99443a00  base: 0x00007f2e99200000   size: 0x0000000000254060
    650689:         entry: 0x00007f2e992042c0  phdr: 0x00007f2e99200040  phnum:                  7

...
    650689:     /usr/lib/libtiff.so.6: error: symbol lookup error: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0 (fatal)
/home/ram/bsc/paraver/wxparaver-4.11.2-Linux_x86_64/bin/wxparaver.bin: symbol lookup error: /usr/lib/libtiff.so.6: undefined symbol: jpeg12_write_raw_data, version LIBJPEG_8.0

The difference between the libjpeg bundled with paraver and the one provided in my system is that it has extra symbols (libjpeg-turbo 3.0.0):

hop% readelf -Ws wxparaver-4.11.2-Linux_x86_64/lib64/wxparaver/libjpeg.so.8 | grep _write_raw_data
    97: 0000000000004a50   244 FUNC    GLOBAL DEFAULT   13 jpeg_write_raw_data@@LIBJPEG_8.0
hop% readelf -Ws /usr/lib/libjpeg.so.8 | grep _write_raw_data
    83: 00000000000380b0   276 FUNC    GLOBAL DEFAULT   10 jpeg_write_raw_data@@LIBJPEG_8.0
   182: 000000000001f990   276 FUNC    GLOBAL DEFAULT   10 jpeg12_write_raw_data@@LIBJPEG_8.0

Here is the whole ld log (with LD_DEBUG=libs,files).

Essentially what is happening is that you are not distributing all the dependencies that wxparaver requires, so you will be eventually bitten by distro updates when they are no longer compatible with the ones bundled with paraver.

The quick and dirty solution is just to preload the system jpeg library, which happens to be compatible with the bundled one:

hop% LD_PRELOAD=/usr/lib/libjpeg.so.8 wxparaver-4.11.2-Linux_x86_64/bin/wxparaver

Or just add it to the wxparaver script:

--- wxparaver-4.11.2-Linux_x86_64/bin/wxparaver 2023-11-03 13:23:44.165159571 +0100
+++ wxparaver-4.11.2-Linux_x86_64/bin/wxparaver 2023-11-03 13:24:30.778268523 +0100
@@ -31,5 +31,6 @@

+export LD_PRELOAD=/usr/lib/libjpeg.so.8
 LD_LIBRARY_PATH="${PARAVER_HOME}/${LIB_DIR}/paraver-kernel:${PARAVER_HOME}/${LIB_DIR}/wxparaver:$LD_LIBRARY_PATH" "${PARAVER_HOME}/bin/wxparaver.bin" "$@"

Which works okay in my system.

You could fix it this time by including the libgdk_pixbuf-2.0.so.0 (and probably others) so it loads the bundled libtiff and libjpeg, but you may want to consider switching to a complete bundle (with all the dependencies) like AppImage or Flatpak so you are completely isolated from the system libraries.

Alternatively, the nice solution for users would be to package and maintain wxparaver for the different distros, but I undersand that would require much more work from your side.

executre commented 8 months ago

As you mentioned, the right way to fix this is to have a compiled package for every distro, but currently we done have enough resources to do that.

Adding ALL the dependencies can make the package very huge, and it may not resolve the problem at all because one of the last dependencies could something related to the system and potentially crashing when trying to run the application.

The current status of the binary package is a trade off for having the less number of dependency libraries included that can work in the majority of desktops at BSC.

Maybe the distro version (opensuse 13.2) that we're using to compile the binary it's a bit old and causing these kind of issues.

We're planning the upgrade to a newer version in the near future, so we can inform you when it's done and try the binary then.