Ubuntu – the role of static libraries

compilingpackage-managementshared library

Static Libraries by default live in /usr/lib or /usr/lib64 but I deleted all of them in my OS with this command:

find / -name *.a -exec rm -rf {} \;

My linux is already OK and everything works good!

Can we say?

" Package.rpm or *.deb contain compiler outputs, only they need shared libraries.

And when we install software from source code,if in the structure use static library,linker in during compile,Copy static libraries to it's executable file.

Without *.a files in my system, maybe in future if i would install software from source code , i will face problems "

Please explain it to me in a simple way

Best Answer

Static libraries are libraries used by binaries at compilation time. They are usually not used again in the runtime as they are linked with the compiled binary at the compilation time and become part of the binary itself.

Also, in implementation, these are not shared among binaries, only the binary that is compiled with specific static library(ies), uses that(those). So in application, these are the quite opposite to the statically linked libraries.

Note that, the static libraries end in .a while the dynamic libraries end in .so.

Related Question