Re: Should .a library contains non-reallocatable code?
Here are two scenarios where building a static library (libfoo) with
-fPIC is desirable:
* libbar has a stable API, so it should be shipped as a .so,
but if it links libfoo.a, and libfoo.a is not -fPIC, then
libbar has to be shipped as a a static library too
* foomodule is a Python wrapper for libfoo, so it must be shipped
as a .so, but if it links libfoo.a, and libfoo.a is not -fPIC,
it is not possible to build foomodule at all
(The same goes for wrapping the library for most other interpreted
languages)
(At $DAY_JOB this bit me in the last week [not pertaining to
Debian-packaged software] so it's a sore spot at the moment)
Unless the circumstances of libfoo make these scenarios unlikely, it
seems like it is better for other packages to prefer -fPIC even when
building a static library.
I wonder whether these scenarios were considered when the Policy was
written.
Jeff
Reply to: