4

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

2
  • 1
    ... why? It's like saying: "I don't use testicles in my daily life, let's cut them off. Oh I can still eat, sleep and work so I'm fine."
    – Bakuriu
    Jul 24, 2016 at 16:44
  • :)) it was a test for understanding
    – Sinoosh
    Jul 24, 2016 at 18:48

2 Answers 2

8

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.

4
  • I think , static library is a part of application and after installing it does not need the source of it
    – Sinoosh
    Jul 24, 2016 at 11:38
  • @Sinoosh Yes, answer clarified..
    – heemayl
    Jul 24, 2016 at 11:54
  • Thanks for editing, if i delete all of statics file maybe in future i will face problems by compiling:)
    – Sinoosh
    Jul 24, 2016 at 12:04
  • 1
    @Sinoosh note that, static libraries mostly come with dev packages which are mostly used for compilation..so if you need to compile packages, you need those..
    – heemayl
    Jul 24, 2016 at 12:06
2

Static libraries are binary independent packages of compiled source code that you "import" in your application when build it in a static manner.

Really, a program called linker, carry out a sort of "copy and paste" of their compiled code along with your compiled source code (it is a bit more complex but this explanation can be go well for respond to your request... ).

Then, the message that you have reported in the OP, says in synthesis that removing static libraries from the directory "lib" doesn't generate problems to the installed programs, because, as said, they are already "pasted" in the binaries of installed programs, and that can happen in Linux because its programs are generally distributed directely by their uncompiled source code, and so they need a compilation step, that generally it is done through with rpm or others linux packages/setup managers.

Instead, as always the posted message says, if you install new programs, then installation could fail, if they need of removed libs, because when compiling, linker won't find needed (referenced) static libs.

I hope it is clear, sorry for my bad English..

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .