Compile as static
mde at micah.elliott.name
Thu Oct 6 18:31:50 CEST 2005
On Oct 06, tjue1 at sussex.ac.uk wrote:
> Has anyone had any luck with this? Im trying to compile python 2.4.2 on
> Slackware 10.1 into one large executable. One which contains everything
> required to run python (as static). So python doesn't look for
> dynamically shared objects like libpthread.so.0.
> I have tried ./configure --disable-dynamic
> However the executable size is always the same :/ Please assist.
ldd is your friend for seeing the dependencies. I see what you mean,
though. I'm no autoconf expert, but AFAICT this was not an intended
feature. My attempted grok of the Makefile also supports this theory.
And I don't see any of the options you specified as being valid. Using
"--disable-shared" also doesn't affect "python", but does appear to make
libpython static, but I think it is regardless. You can force the issue
$ ../configure ...
$ make LDFLAGS=-static
$ ls -l ./python
-rwxr-xr-x 1 mdelliot support 2888818 Oct 6 08:06 ./python
$ ldd ./python
not a dynamic executable
But this gives some import warnings, and running has some problems...
Then I found these, indicating that it is easy ;-)
It might be nice to have an autoconf option to make this more obvious
for guys like us. Maybe this is just a rare need.
<mde at micah.elliott.name>
More information about the Python-list