Linux does not depend on shared libraries

I have a C ++ program that depends on quite a few libraries (some common system libraries, such as libjpeg, some personal libraries that are not installed on the system). The program compiles well on machine A (Squeeze Debian). I would like to run the program on machine B (Ubuntu maveric) and machine C (Arch). Assume that both B + C machines are extremely minimal settings. Do not expect to find ANY libraries that my program uses there, and if they are, they are not the same version.

Is there any program that can scan my program for ALL dependencies (using ldd or something else), collect all these dependencies and generate a script that tells the binary to use these and only these libraries that it uses on any another system?

Thanks!

+4
source share
2 answers

I am not 100% sure, I understand your question, but it seems that you want to send libraries along with your package and use LD_LIBRARY_PATH to force the linker to search in your submitted library directory first of all.

If that is not all, I can reconsider my answer, as I have some experience with this. I just want to make sure that I know what you're asking for.

+2
source

It turns out that the answer to your question is to link statically, say, with g ++ -static.

+2
source

Source: https://habr.com/ru/post/1337375/


All Articles