Difference between pic Vs pie

From the gcc documentation: -fpicGenerate position-independent code (PIC) suitable for use in a shared library… -fpieThese options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables….

What is a file with extension .a?

.a files are static libraries typically generated by the archive tool. You usually include the header files associated with that static library and then link to the library when you are compiling.

Linux error while loading shared libraries: cannot open shared object file: No such file or directory

UpdateWhile what I write below is true as a general answer about shared libraries, I think the most frequent cause of these sorts of message is because you’ve installed a package, but not installed the -dev version of that package. Well, it’s not lying – there is no libpthread_rt.so.1 in that listing. You probably need to re-configure and re-build … Read more

Linux error while loading shared libraries: cannot open shared object file: No such file or directory

UpdateWhile what I write below is true as a general answer about shared libraries, I think the most frequent cause of these sorts of message is because you’ve installed a package, but not installed the -dev version of that package. Well, it’s not lying – there is no libpthread_rt.so.1 in that listing. You probably need to re-configure and re-build … Read more

What are .a and .so files?

Archive libraries (.a) are statically linked i.e when you compile your program with -c option in gcc. So, if there’s any change in library, you need to compile and build your code again. The advantage of .so (shared object) over .a library is that they are linked during the runtime i.e. after creation of your … Read more