I have an executable file (which I get by compiling MyProg.c). Before, I statically linked the library to it (libMyL.so).
This is how the library is created:
gcc -Wall -fPIC -c f1.c f2.c f3.c -Ilib gcc -shared f1.o f2.o f3.o -o libMyL.so -lrt -lpthread
This is how the library is linked to the program:
gcc MyProg.c -L. -lMyL -o MyProg
Accordingly, for the program to run on another computer, libMyL.so should be, for example, in /lib
.
Everything is working. But now I need to link, preferably, absolutely everything statically. That is, so that there is no dependence on the libraries and could be transferred to a computer with the same architecture.
Those. for example, if I want to build an executable file and stuff all the libraries into it, I do this:
Hello.c file content
#include <stdio.h> int main( int argc, char* argv[] ) { printf( "Hello world!" ); return 0; } gcc -static Hello.c -o Hello
The Hello file is 500 Kb. All OK. Similarly, I need with MyProg + libMyL.so. It is necessary, apparently, that in MyProg everything was collected statically, and in libMyL.so to push all the dependencies. The fact that you get a large amount is okay. How do I implement this?