2

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?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
jirinovo
  • 185
  • 1
  • 6
  • Why don't you link this statically? – rudimeier May 08 '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 08 '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 08 '17 at 15:15
  • @thrig My distro is Ubuntu which si following the File System Hierarchy Standard. But according to [this](https://askubuntu.com/a/17546/599219) `/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 08 '17 at 15:22

0 Answers0