Can you list all .so files referenced by a binary?
This is to package and deploy a binary along with all .so files it needs to servers. As I understand it you can’t statically link with .so files, but you can probably make a self extracting archive.
This is what the
ldd program does. Given the path to an executable and no other options, it will list the shared libraries the program needs, and the current paths of those shared libraries on the system (if present).
$ ldd /usr/bin/bash linux-vdso.so.1 (0x00007ffc19b28000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fb815da1000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fb815b9d000) libc.so.6 => /lib64/libc.so.6 (0x00007fb8157d7000) /lib64/ld-linux-x86-64.so.2 (0x000056504b842000)
So, yes you can, but that doesn’t really help you as much as you think.
Rather than manually creating your own archives, you should use a packaging system such as rpm or deb, depending on the target distribution, or the more recent Flatpak (which is probably going to be how most apps get distributed in future Linux distributions).
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.