Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 125992 - Enable static python build with portage
Summary: Enable static python build with portage
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 212178
  Show dependency tree
 
Reported: 2006-03-12 15:22 UTC by infobox.oleg
Modified: 2008-03-27 09:19 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description infobox.oleg 2006-03-12 15:22:47 UTC
I didn't find such a request, but I'm sure somebody already asked about this: portage is written in python. If python is built with shared libraries and if some emerge breaks shared libraries (my favorite is glibc:(, there is no way to go back, because python is dead without shared libraries. So I propose a static USE flag, which would enable me to get static-linked python. Of course I can dig in the ebuild (oh, I did that) how python is compiled and try to compile it manually, but it is a no fun work (at least for me).

Basicly there is a flag --enable-shared in the ebuild. This flag is passed to configure, which should create Makefile for shared-libraries python. If you replace that by --disable-share, that should configure to build a static-linked python.

Actually I think, that gentoo should be shipped with static-linked python (see above for the reason) out of the box.
Comment 1 infobox.oleg 2006-03-12 15:37:29 UTC
Ok... I tried:

cd Python-2.4.2
./configure --disable-shared
make

I was wrong about the flag --disable-shared, because ldd python doesn't tell, that "not a dynamic executable" (it gives standard dependencies, I can't copy paste here from MS VirtualPC:)
Comment 2 Alastair Tse (RETIRED) gentoo-dev 2006-09-02 05:26:23 UTC
yeah, i've always thought about that, but no one has really done any work on figuring out how to package this up. do we have a sys-apps/portage bundle it or a new python-static package. this is low priority at the moment.
Comment 3 Tiziano Müller (RETIRED) gentoo-dev 2008-03-03 17:17:19 UTC
Well, passing CPPFLAGS="-static" LDFLAGS="-static -static-libgcc" creates a statically linked python executable.
The problem is that also the standard _non_ pure python modules must be linked statically, which is probably also doable.
But when trying to load a statically linked binary module from within the statically linked python interpreter, I get the following:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.5/site-packages/lcms.py", line 7, in <module>
    import _lcms
ImportError: /usr/lib64/python2.5/site-packages/_lcms.so: undefined symbol: sem_init
Comment 4 Tiziano Müller (RETIRED) gentoo-dev 2008-03-08 08:35:50 UTC
Ok, to use a static python, all modules have to be built statically and extra linker-flags have to be passed to get the symbols resolved.
Since we (portage-people and I) didn't find any use case where a statically linked python is of help (if glibc is broken then a lot of other tools are and you need a glibc-binpackage anyway, which in turn can be merged using qmerge (which in turn is written in C and statical linked and really independent of other stuff)), I'm closing this bug as WONTFIX.
Please reopen if you think there actually _is_ a use case for this (not even the embedded people did want such a feature).