Is there any open-source way to make a static from a dynamic executable with no source code availability?

You can solve your problem in another and more simple way:

Use ldd on your executable to see the linked libraries, for example:

$ ldd /bin/bash
linux-vdso.so.1 =>  (0x00007fffb2fd4000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fac9ef91000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fac9ed8d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fac9e9c6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fac9f1e1000)

Then collect all the libraries in a folder and set the LD_LIBRARY_PATH environment variable before running your program to point at this folder:

$ LD_LIBRARY_PATH="/opt/my_program/lib" /opt/my_program/start

Alternatively you can add an entry for the lib folder to /etc/ld.so.conf.d/. But that would apply the change systemwide.


Opensource mkblob can make a new binary executable which includes all the dependencies your program needs and you will be able to distribute it to other (also later) distributions than the one it was compiled on. It works a little like Statifier and Ermine which was mentioned.