Package and Deploy Linux Binary

jcarpenter asked:

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.

My answer:

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).

For example:

$ ldd /usr/bin/bash (0x00007ffc19b28000) => /lib64/ (0x00007fb815da1000) => /lib64/ (0x00007fb815b9d000) => /lib64/ (0x00007fb8157d7000)
    /lib64/ (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).

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.