473,765 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

build a static python executable on linux?

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
gi****@scripps. edu

Jul 18 '05 #1
6 22720
On Mon, 29 Sep 2003 15:42:34 -0700, rumours say that Alexandre Gillet
<gi****@scripps .edu> 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.
Jul 18 '05 #2
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
<gi****@scripps .edu> 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.


Jul 18 '05 #3
Alexandre Gillet <gi****@scripps .edu> 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
Jul 18 '05 #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

Jul 18 '05 #5
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: gi****@scripps. edu
/ 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
Jul 18 '05 #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: gi****@scripps. edu
/ 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

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2930
by: Bren | last post by:
Hi, Pardon my stupid, but I'm having a problem building Boost.Python as per the instructions at http://www.boost.org/libs/python/doc/building.html I got boost-build-2.0-m6.zip from sourceforge and build bjam.exe. I've tried several ways:
1
1864
by: sarmin kho | last post by:
Hi Pythoners, i remember that i saw posting about changing the icon of a python executable but i kind of lost where to find the posting... basically, this is my first time using the py2exe to create python executable... it came out with an executable file with an icon that i would like to change... any guide please... many thanks Pythoners...
3
2886
by: Grzegorz Dostatni | last post by:
Cheers. First what I am trying to do: I am trying to create a version of pytho23.dll that contains everything inside of it. It is staticaly linked. It also needs to contain the qt library. For this I am trying to work off of instructions designed for unix/linux using visual c++.net and gui. I can compile basic python - that's not a problem. Once I add the paths and dependencies for qt (as well as modifying the config.c) I get an error:
3
1639
by: Simon Faulkner | last post by:
Hi All, I've written a fair bit of simple Python for Linux and have been asked to write a program for win32. Is it possible to write a program and add the Python interpreter so that I just end up with a single .exe file for windows? I know that it will be large but it will be simple!
3
2585
by: Nickolay | last post by:
it's easy to create small executable from python code, when using assembler compilers. I ask you if need it?
1
2095
by: | last post by:
Hello, I tried to build Python 2.4.1 on a Reliant Unix system. Just after the python executable program has been built, I get the following error: ==== begin make output === CC -W1 -Blargedynsym -o python \ Modules/python.o \ libpython2.4.a -lresolv -lsocket -lnsl -ldl -lm
10
1982
by: magneticlemur | last post by:
Hi, Does anyone know of an available downloader for an amd64 bit build of (a modern) python? I've done my due diligence search of python docs and mailing archives, and I'm somewhat mystified by the lack of info on this topic. I'm embedding python in a native 64 bit application so python32 using WOW64
0
1177
by: Alan | last post by:
Dears, It's about Pyhton for Linux X86. First, I would like to know if it's possible to build a fully static python binary, something that does not depends on others libraries when using 'ldd python', e.g. If so, how? Second, I would like to build a python for distribution that would include (statically if possible) the package Numeric-24.2. Is it
1
1246
by: Tim Mitchell | last post by:
Hi, A quick question: Is there any way for a python script to know if it's being executed by a debug build of python (python_d.exe) instead of python? Thanks Tim
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.