How to list library dependencies of a non-native binary?

后端 未结 9 870
孤城傲影
孤城傲影 2020-12-12 16:03

When developing for native platform, I can use ldd to list all the shared libraries (.so files) a binary executable I build will try to load upon start-up. But when cross-co

9条回答
  •  眼角桃花
    2020-12-12 16:39

    A bit late for this addition but someone might benefit/clarify. Doesn't the -A flag to readelf give the same result as ldd?

        $ readelf -AW /bin/vi
    
    Library list section '.gnu.liblist' contains 8 entries:
         Library              Time Stamp          Checksum   Version Flags
      0: libselinux.so.1      2011-07-25T08:02:58 0x17a7d5f7 0       0
      1: libtermcap.so.2      2011-07-25T08:02:59 0x29ae9ff7 0       0
      2: libacl.so.1          2011-07-25T08:02:58 0x60748842 0       0
      3: libc.so.6            2011-07-25T08:02:58 0x0c2c7eeb 0       0
      4: libdl.so.2           2011-07-25T08:02:58 0xdfbfc467 0       0
      5: libsepol.so.1        2011-07-25T08:02:58 0x857499cb 0       0
      6: /lib64/ld-linux-x86-64.so.2 2011-07-25T08:02:58 0x9e6549b7 0       0
      7: libattr.so.1         2011-07-25T08:02:58 0x862f1546 0       0
    

    The only info missing here seems to be the full path where those libraries are located.

    On the other hand, the tools mentioned so far are only useful once you have an installation known to work. My most common problems are:

    1. Installing a program (mostly via rpm) that then fails to start or crashes during start up. Somehow I think this is related to library incompatibilities but I haven't found an easy way of checking these thing before installing a program (nor indeed after)
    2. In an attemtp to overcome (1), sometimes I have resorted to downloading the sources and compiling locally. The typical configure script is partially helpful because it tells you which libraries you are missing. However, it fails to tell you what the lowest version of such libraries are required

    Can anyone shed some light on these issues? BTW, I have tried reading installation instructions and release notes but they are almost always nowhere near sufficient.

    A beefy example may put everything into context, so please try compiling Cinelerra.

提交回复
热议问题