Building Python statically on linux

Micah Elliott mdelliot at gmail.com
Thu Dec 27 10:53:57 EST 2007


Are there instructions somewhere on how to build Python (on linux)
statically?  This seems like a common thing to do want to do, but my
searching isn't turning up much.  If it is common, it would be nice to
see a configure option like I've seen in other tools:

  --enable-all-static     Build completely static (standalone)
binaries.

I'm ./configure-ing with "--disable-shared" (because this must mean
"enable static", right?), and (based on some other posts here) tried
adding "*static*" near the top of Modules/Setup.  I'd like to see ldd
tell me "not a dynamic executable", but alas, it's presently:

$ ldd /path/to/new/bin/python
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x008e9000)
        libdl.so.2 => /lib/libdl.so.2 (0x007f0000)
        libutil.so.1 => /lib/libutil.so.1 (0x00df6000)
        libm.so.6 => /lib/tls/libm.so.6 (0x007cb000)
        libc.so.6 => /lib/tls/libc.so.6 (0x0069f000)
        /lib/ld-linux.so.2 (0x00682000)

Do I just need to be passing something like LDFLAGS="-static ???" to
configure?  I just tried that and got a bunch of "symbol rename"
warnings during the compilation, and then "make install" mysteriously
failed.

Thanks for any pointers.
--
Micah



More information about the Python-list mailing list