If I want to create a static library for everyone to use, is it necessary compile it with -fPIC or -fPIE?
It is working for me without -fPIC or -fPIE.
If I want to create a static library for everyone to use, is it necessary compile it with -fPIC or -fPIE?
It is working for me without -fPIC or -fPIE.
You want your library to be linkable into shared libraries, position-dependent and position-independent executables. The only flag which works in all of these cases is -fPIC
so that's the one you should use.