My software tool has some external dependencies. I am distributing it as a conda package for linux64 with precompiled dependencies including shared libraries. Unfortunately I don't know how to recognize the system libraries from the software-specific ones. I think distributing libs like libc is not necessary and even should be avoided, because different Linux distros can have specific versions of some system libs.

I am using this simple oneliner to export shared libs (source):

$ ldd file | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /destination

For example, these are the shared libs for Tesseract software:

$ ldd tesseract.bin 
linux-vdso.so.1 =>  (0x00007ffff4bc7000)
libtesseract.so.4 => not found
liblept.so.5 => not found
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0ad8bf3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0ad89dc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0ad8615000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0ad830a000)
/lib64/ld-linux-x86-64.so.2 (0x0000563cf6115000)

As you can see, only libtesseract.so.4 and liblept.so.5 are software-specific libs (not found because they aren't in LD_LIBRARY_PATH).

So is there any way to recognize the system shared libraries? I can check if they are in /lib, but is this always true? Are there only system libs so they can't be somewhere else?

  • Why don't you link this statically? – rudimeier May 8 '17 at 12:47
  • 1
    /lib depends on how exotic the Linux is; NixOS for example has no /lib (nor /lib64) directory. You could try asking the ports or package system, I guess, to see if something belongs to a known port or package... – thrig May 8 '17 at 14:44
  • @rudimeier That's the best solution, but unfortunately it's very complicated (even impossible) in case of some libs. I have tried that. – jirinovo May 8 '17 at 15:15
  • @thrig My distro is Ubuntu which si following the File System Hierarchy Standard. But according to this /lib contains libs needed for boot and for binaries in /bin. So I think not all the system libs are there. On the other hand if I filter libs located there, I should filter most of the system libs and the rest can be checked manually. – jirinovo May 8 '17 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.