Shared libpython, PIC, whinery (was Re: Embedding python in .so, /libpython2.2.a not position independent (hp-ux)??

Ville Vainio vvainio at
Wed Jan 16 13:10:25 CET 2002

Erno Kuusela <erno-news at> writes:

> the debian python packages come with libpython as shared library.  you
> could look at the source package (or diff) for clues on how to do it.

I took a look. Debian seems to compile special .pic_o versions and
then links an .so from them. Congratulations for all the lucky users
of debian - their solution seems to be rather 'heavyweight' for an
ad-hoc solution that I need, however.

Back to hp-ux. Now, I have been able to recompile python w/ -fPIC and
it seems to work ok (test suite doesn't fare any worse than it did w/o
-fPIC). Now I can manually extract the .o's and build a .sl of my
own. My question is: why is libpython not built to be position
independent in the first place? That doesn't cause platform depence,
does it? In the minimun, there should be a hint in the Makefile
somewhere suggesting that you could make it PIC, by uncommenting
something or whatever. The current approach requires a bit too much
hacking to be easily repeatable (by code maintainers etc.).

[OT] Embedding python could be marketed as a way of doing OO in C,
instead of embedding in interpreter... one that includes dynamic data
structures as a free extra feature.

Ville Vainio - - ICQ #115524762
 Wild geese have no intention to cast a reflection
 Water has no mind to assume their form

More information about the Python-list mailing list