statically linked python

Ralph Butler rbutler at mtsu.edu
Sun Jun 18 00:26:48 CEST 2006


Hi:

I have searched the docs and google but have not totally figured
out how to accomplish my task:  On a linux box, I want to compile
and link python so that it uses no shared libraries, but does support
import of some "extra" modules.  I have made a few attempts but
with limited success.  In particular, I have tried things like
adding -static to the compiler options in the Makefile.

At one point I managed to build a python that was close to what I
wanted, e.g. when I ran "ldd python", it said:
     not a dynamic executable
In that version, when I do some imports, e.g. sys, os, etc. they
load fine.  But, when I try to import some other modules, e.g. time,
they are not found.  I have tried similar procedures while also
altering Modules/Setup.local (produced by configure) to contain:
     time timemodule.c # -lm # time operations and variables

There has to be a simple, "elegant" way to accomplish this which I am
simply overlooking.  Any help would be appreciated.

Thanks.
--ralph



More information about the Python-list mailing list