static python build?

Discussion in 'Python' started by mudd@vex.net, Aug 6, 2004.

  1. Guest

    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
     
    , Aug 6, 2004
    #1
    1. Advertising

  2. 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
     
    Michael Hudson, Aug 6, 2004
    #2
    1. Advertising

  3. Guest

    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
    --------------------------------------------------------------------------





    > 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
    >
     
    , Aug 6, 2004
    #3
  4. 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
     
    Michael Hudson, Aug 7, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandre Gillet

    build a static python executable on linux?

    Alexandre Gillet, Sep 29, 2003, in forum: Python
    Replies:
    6
    Views:
    1,033
    Alexandre Gillet
    Sep 30, 2003
  2. Nicolas Lehuen
    Replies:
    3
    Views:
    744
    Nicolas Lehuen
    Jan 28, 2004
  3. Torsten Mohr
    Replies:
    4
    Views:
    406
    Torsten Mohr
    Dec 30, 2004
  4. Toon Knapen
    Replies:
    2
    Views:
    375
    Toon Knapen
    May 17, 2006
  5. Wong Wah Meng-R32813
    Replies:
    0
    Views:
    724
    Wong Wah Meng-R32813
    Sep 18, 2011
Loading...

Share This Page