How to find which part of a binary requires a certain version of a certain dependency?

66 Views Asked by At

I am compiling some inherited code onto a linux platform. When I try to run it, I get a library versioning error:

[aardvark@aardvark-burrow /data/users/aardvark/project-source]  /data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay
/data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay)

First off, who cares that I have GLIBC_2.28, not 2.29, and why do they care? Is it a compile flag passed to build the final executable (fcv_replay), or one of its many dependencies? How do I find out? I basically want to know what to look for inside a large, complex build system that I didn't create.

Here are the results of another query:

[aardvark@ /data/users/aardvark/project-source] ldd /data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay
/data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /data/users/aardvark/project-source/buck-out/gen/arvr/projects/viper/applications/replay/fcv_replay)
        linux-vdso.so.1 (0x00007ffe84592000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe4daefd000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fe4dab7b000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fe4da977000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe4da5b2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe4db11d000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe4da39a000)
1

There are 1 best solutions below

6
yugr On

You app, fcv_replay, has been compiled on a newer Linux distro (or a new toolchain) and is using some new functions from libm library which are missing in your current distro.

You can see which part of the executable is causing the problem by inspecting the disassembly:

$ objdump -dr /bin/nautilus | grep -C5 GLIBC_2.29 | head
000000000004a430 <pow@plt>:
   4a430:   f3 0f 1e fa             endbr64 
   4a434:   f2 ff 25 45 1e 16 00    bnd jmpq *0x161e45(%rip)        # 1ac280 <pow@GLIBC_2.29>
   4a43b:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
...

The best solution would be to rebuild fcv_replay on the oldest possible distro to avoid dependency on new versions of libc.