`-fPIC` is a flag for the C compiler `gcc` which causes position-independent code to be produced. Position-independent code is important when compiling libraries which are to be dynamically linked, also known as .dll (dynamically-linked libraries) in Windows or .so (shared objects) in Linux. Use this tag if you have problems compiling code when the flag `-fPIC` is in use, or when asking about building binaries with this flag.
-fPIC
is a flag for the C compiler gcc
which causes position-independent code to be produced. Position-independent code is important when compiling libraries which are to be dynamically linked, also known as .dll (dynamically-linked libraries) in Windows or .so (shared objects) in Linux.
Taken from man gcc
for gcc 4.6.3, on Ubuntu 12.04:
-fPIC
If supported for the target machine, emit position-independent
code, suitable for dynamic linking and avoiding any limit on the
size of the global offset table. This option makes a difference on
the m68k, PowerPC and SPARC.
Position-independent code requires special support, and therefore
works only on certain machines.
When this flag is set, the macros "__pic__" and "__PIC__" are
defined to 2.