Static executable with shared modules

"Martin v. Löwis" martin at v.loewis.de
Fri Jan 14 12:25:15 EST 2005


Rickard Lind wrote:
> Is there any way to build the python executable statically and
> still be able to load modules built as shared libraries?

I'm not what "build statically" means; if you talking about
building a statically linked interpreter binary - then no,
this is not possible. At a minimum, you need to link with -ldl,
or else you cannot perform dlopen(3).

> I'm trying to run python scripts on a stripped down FreeBSD (4.9)
> machine which has no shared system libraries so I want to link it
> statically against libc et al, but it would be nice to still be
> able to load modules which were built as shared libraries.

Does that system support shared libraries? What is the API for
loading shared libraries, and finding a symbol in a dynamically-loaded
shared library, on that system?

> In
> particular I have a library for which I've generated a wrapper
> with swig which I'd like to import.

If shared libraries are not supported, you could link the swig
module statically as well.

Regards,
Martin



More information about the Python-list mailing list