469,599 Members | 2,857 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

static python build?

How do I build Python so that I get static libraries instead of dynamic
libraries (e.g. build/lib.solaris-2.8-sun4u-2.3/math.so)?

John
Jul 18 '05 #1
3 7062
mu**@vex.net writes:
How do I build Python so that I get static libraries instead of dynamic
libraries (e.g. build/lib.solaris-2.8-sun4u-2.3/math.so)?


Edit Modules/Setup. The comments in the file should get you started.

Cheers,
mwh

--
Monte Carlo sampling is no way to understand code.
-- Gordon McMillan, comp.lang.python
Jul 18 '05 #2
Yes, thanks!, it was easy. I just edited Modules/Setup as follows:

(1) Changed the commented *shared* line to the *static* line (see below).

(2) Uncommented the modules (math, time, array) that I wanted incorporated
into the static libpython.a library.

(3) Added lines for a couple other modules (strop & _random) that
previously weren't listed in the Setup file.

(4) Reran configure, make & make install. It works!

Now I can run freeze.py and build a truly stand-alone executable including
the modules I mentioned.

Here's a section of Modules/Setup with my changes:
--------------------------------------------------------------------------
# Uncommenting the following line tells makesetup that all following #
modules are to be built as shared libraries (see above for more
# detail; also note that *static* reverses this effect):

*static*

# Modules that should always be present (non UNIX dependent):

array arraymodule.c # array objects
#cmath cmathmodule.c # -lm # complex math library functions
math mathmodule.c # -lm # math library functions, e.g. sin()
#struct structmodule.c # binary structure packing/unpacking
time timemodule.c # -lm # time operations and variables
#operator operator.c # operator.add() and similar goodies
#_weakref _weakref.c # basic weak reference support
#_testcapi _testcapimodule.c # Python C API test module
strop stropmodule.c
_random _randommodule.c
--------------------------------------------------------------------------


mu**@vex.net writes:
How do I build Python so that I get static libraries instead of dynamic
libraries (e.g. build/lib.solaris-2.8-sun4u-2.3/math.so)?
Edit Modules/Setup. The comments in the file should get you started.

Cheers,
mwh

--
Monte Carlo sampling is no way to understand code.
-- Gordon McMillan, comp.lang.python
--
http://mail.python.org/mailman/listinfo/python-list


Jul 18 '05 #3
mu**@vex.net writes:
Yes, thanks!, it was easy. I just edited Modules/Setup as follows:

(1) Changed the commented *shared* line to the *static* line (see below).

(2) Uncommented the modules (math, time, array) that I wanted incorporated
into the static libpython.a library.

(3) Added lines for a couple other modules (strop & _random) that
previously weren't listed in the Setup file.


I'm a bit surprised strop wasn't in there. _random probably should
be, too. File a bug on SF?

Cheers,
mwh

--
<washort> glyph: you're evil, too
<glyph> washort: I try
<washort> not the good kind of evil
<washort> the other kind -- from Twisted.Quotes
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Christos TZOTZIOY Georgiou | last post: by
6 posts views Thread by Alexandre Gillet | last post: by
reply views Thread by Helmut Zeisel | last post: by
3 posts views Thread by Grzegorz Dostatni | last post: by
4 posts views Thread by Torsten Mohr | last post: by
reply views Thread by Samuel M. Smith | last post: by
1 post views Thread by Will Ware | last post: by
9 posts views Thread by Chris Pearl | last post: by
reply views Thread by Alan | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.