build a static python executable on linux?

Discussion in 'Python' started by Alexandre Gillet, Sep 29, 2003.

  1. Hi,

    I am trying to build a python interpreter that is static link.
    My python interpreter was build on RedHat 8.0 using gcc 2.3 and GLIBC 2.3
    When running on other linux flavor that still have GLIBC 2.2, the
    interpreter won't start. (error message: /lib/libc.so.6: version
    `GLIBC_2.3' not found (required by /mgl/python/i86Linux2/bin/python2.3)

    Is there a way to build a static python interpreter using gcc 2.3 that
    can run on any machine and won't need a shared library at runtime?

    I want to be able to build my interpreter on my redhat machine and
    distribute my executable that can then be run on other machine without
    having to worry about the version of glibc.

    Thanks for any help or idea in advances.

    Alex
     
    Alexandre Gillet, Sep 29, 2003
    #1
    1. Advertising

  2. On Mon, 29 Sep 2003 15:42:34 -0700, rumours say that Alexandre Gillet
    <> might have written:

    >I am trying to build a python interpreter that is static link.
    >My python interpreter was build on RedHat 8.0 using gcc 2.3 and GLIBC 2.3
    >When running on other linux flavor that still have GLIBC 2.2, the
    >interpreter won't start. (error message: /lib/libc.so.6: version
    >`GLIBC_2.3' not found (required by /mgl/python/i86Linux2/bin/python2.3)


    I believe you should install the glibc-static-devel package and then
    find the approprate options for gcc (my noisy linux computer is turned
    off now so I can't man gcc, but IIRC is -static :) in order to build a
    static python.
    --
    TZOTZIOY, I speak England very best,
    Microsoft Security Alert: the Matrix began as open source.
     
    Christos TZOTZIOY Georgiou, Sep 30, 2003
    #2
    1. Advertising

  3. I am able to compile a static interpreter (using -static -static-libgcc)
    but I can not build the extensions correctly.
    When I import an extensions (ie Tkinter, readline) I get undefine
    symbol error. It seems the symbol should be define in glibc but the
    extensions can't seems to find it.

    Any ideas how I should built the extensions

    Thanks
    Alex

    Christos TZOTZIOY Georgiou wrote:
    > On Mon, 29 Sep 2003 15:42:34 -0700, rumours say that Alexandre Gillet
    > <> might have written:
    >
    >
    >>I am trying to build a python interpreter that is static link.
    >>My python interpreter was build on RedHat 8.0 using gcc 2.3 and GLIBC 2.3
    >>When running on other linux flavor that still have GLIBC 2.2, the
    >>interpreter won't start. (error message: /lib/libc.so.6: version
    >>`GLIBC_2.3' not found (required by /mgl/python/i86Linux2/bin/python2.3)

    >
    >
    > I believe you should install the glibc-static-devel package and then
    > find the approprate options for gcc (my noisy linux computer is turned
    > off now so I can't man gcc, but IIRC is -static :) in order to build a
    > static python.
     
    Alexandre Gillet, Sep 30, 2003
    #3
  4. Alex> I am able to compile a static interpreter (using -static
    Alex> -static-libgcc) but I can not build the extensions correctly.

    You effectively need to transport yourself back in time before distutils
    existed, and modify Modules/Setup (or more correctly, Modules/Setup.local)
    appropriately to define the build commands for all the extension modules you
    want to include in your interpreter. It's a little tedious the first time
    (it will probably take a few iterations to get everything correct), but once
    you get the hang of it, it's easy to do. Use the compile and link commands
    output by distutils to give yourself a head start on -I, -L and -l flags to
    include in your definitions. Many of the commented out definitions are
    probably also close.

    If you identify some modules with no commented out build definitions in the
    Setup file, please file a bug report on SourceForge.

    Skip
     
    Skip Montanaro, Sep 30, 2003
    #4
  5. Alexandre Gillet <> writes:

    > I am able to compile a static interpreter (using -static
    > -static-libgcc) but I can not build the extensions correctly.
    > When I import an extensions (ie Tkinter, readline) I get undefine
    > symbol error. It seems the symbol should be define in glibc but the
    > extensions can't seems to find it.
    >
    > Any ideas how I should built the extensions


    By editing Modules/Setup, I suspect.

    Cheers,
    mwh

    --
    I'm sorry, was my bias showing again? :)
    -- William Tanksley, 13 May 2000
     
    Michael Hudson, Sep 30, 2003
    #5
  6. Thanks for the hints.
    But I think it will too much work to do now and not enough time. So I
    will probably build my interperter with a older version of glibc so I am
    sure it will run on all the linux platform and not only the one using
    glibc 2.3

    Thanks
    Alex

    Skip Montanaro wrote:
    > Alex> I am able to compile a static interpreter (using -static
    > Alex> -static-libgcc) but I can not build the extensions correctly.
    >
    > You effectively need to transport yourself back in time before distutils
    > existed, and modify Modules/Setup (or more correctly, Modules/Setup.local)
    > appropriately to define the build commands for all the extension modules you
    > want to include in your interpreter. It's a little tedious the first time
    > (it will probably take a few iterations to get everything correct), but once
    > you get the hang of it, it's easy to do. Use the compile and link commands
    > output by distutils to give yourself a head start on -I, -L and -l flags to
    > include in your definitions. Many of the commented out definitions are
    > probably also close.
    >
    > If you identify some modules with no commented out build definitions in the
    > Setup file, please file a bug report on SourceForge.
    >
    > Skip
    >
    >


    --
    o Alexandre Gillet email:
    / The Scripps Research Institute,
    o Dept. Molecular Biology, MB-5,
    \ 10550 North Torrey Pines Road,
    o La Jolla, CA 92037-1000, USA.
    / tel: (858) 784-2053
    o fax: (858) 784-2860
     
    Alexandre Gillet, Sep 30, 2003
    #6
  7. Thanks for the hints.
    But I think it will too much work to do now and not enough time. So I
    will probably build my interperter with a older version of glibc so I am
    sure it will run on all the linux platform and not only the one using
    glibc 2.3

    Thanks
    Alex

    Skip Montanaro wrote:
    > Alex> I am able to compile a static interpreter (using -static
    > Alex> -static-libgcc) but I can not build the extensions correctly.
    >
    > You effectively need to transport yourself back in time before distutils
    > existed, and modify Modules/Setup (or more correctly, Modules/Setup.local)
    > appropriately to define the build commands for all the extension modules you
    > want to include in your interpreter. It's a little tedious the first time
    > (it will probably take a few iterations to get everything correct), but once
    > you get the hang of it, it's easy to do. Use the compile and link commands
    > output by distutils to give yourself a head start on -I, -L and -l flags to
    > include in your definitions. Many of the commented out definitions are
    > probably also close.
    >
    > If you identify some modules with no commented out build definitions in the
    > Setup file, please file a bug report on SourceForge.
    >
    > Skip
    >
    >


    --
    o Alexandre Gillet email:
    / The Scripps Research Institute,
    o Dept. Molecular Biology, MB-5,
    \ 10550 North Torrey Pines Road,
    o La Jolla, CA 92037-1000, USA.
    / tel: (858) 784-2053
    o fax: (858) 784-2860
     
    Alexandre Gillet, Sep 30, 2003
    #7
    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. Torsten Mohr
    Replies:
    4
    Views:
    402
    Torsten Mohr
    Dec 30, 2004
  2. Replies:
    15
    Views:
    502
    Dave Thompson
    Aug 21, 2006
  3. pratap
    Replies:
    20
    Views:
    779
    Flash Gordon
    Mar 7, 2007
  4. Jason Cavett
    Replies:
    8
    Views:
    640
    Sanjay
    May 16, 2007
  5. Replies:
    0
    Views:
    454
Loading...

Share This Page