This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author miro_ilias
Recipients Ari.Consul, asisco, dmalcolm, eraonel, eric.araujo, flox, hozn, loewis, miro_ilias, orsenthil, spaceli, spprakash
Date 2012-03-18.20:31:41
SpamBayes Score 1.985419e-10
Marked as misclassified No
Message-id <C2E47DDD62F84E4CAF40AFFA65C0843C100F54C6D7@MAILBOX2.umb.sk>
In-reply-to <1330480159.89.0.133099991131.issue9631@psf.upfronthosting.co.za>
Content
Dear Space, 

On my Ubuntu 11.10 x86_64 Linux I have static python buildup prescription:
./configure LDFLAGS="-static -static-libgcc"  --disable-shared   CPPFLAGS=-static --prefix=/home/ilias/bin/python_static

with *static* in Modules/Setup

but 'make' failes, getting errors like:

collect2: ld returned 1 exit status
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status
.
.
.
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c: In function ‘mmap_resize’:
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3193:5: warning: implicit declaration of function ‘mremap’ [-Wimplicit-function-declaration]
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3193:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c: In function ‘sys_trim’:
/home/ilias/bin/python_static/Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c:3612:62: warning: comparison between pointer and integer [enabled by default]
/usr/bin/ld: error: /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__DTOR_END__' which may overflow at runtime; recompile with -fPIC
collect2: ld returned 1 exit status

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel   
_sqlite3           _ssl               _tkinter        
bsddb185           bz2                dbm             
dl                 gdbm               imageop         
linuxaudiodev      ossaudiodev        readline        
sunaudiodev        zlib                               
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_bisect            _codecs_cn         _codecs_hk      
_codecs_iso2022    _codecs_jp         _codecs_kr      
_codecs_tw         _collections       _csv            
_ctypes            _ctypes_test       _elementtree    
_functools         _heapq             _hotshot        
_io                _json              _locale         
_lsprof            _md5               _multibytecodec 
_multiprocessing   _random            _sha            
_sha256            _sha512            _socket         
_struct            _testcapi          array           
audioop            binascii           cmath           
cPickle            crypt              cStringIO       
datetime           fcntl              future_builtins 
grp                itertools          math            
mmap               nis                operator        
parser             pyexpat            resource        
select             spwd               strop           
syslog             termios            time            
unicodedata                         

Any help, please ?

________________________________________
From: Space Li [report@bugs.python.org]
Sent: Wednesday, February 29, 2012 2:49 AM
To: Ilias Miroslav
Subject: [issue9631] Python 2.7 installation issue for Linux gcc-4.1.0-3        (Fedora Core 5?)

Space Li <spacelis@gmail.com> added the comment:

Hi,

I recently compiled Python 2.7.2 and got an ImportError on struct module during 'make install'.

What I found working for me is just to 'make'. Before doing 'make install', copy the lib.linux-xxxxx directory in 'build' to {prefix}/lib/python2.7 and rename it as lib-dynload.

Then find something that looks like followings:
        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

Add :$(DESTSHARED) behind each PYTHONPATH. Then it looks like

        $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST) -f \
                -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
                $(DESTDIR)$(LIBDEST)
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED)  $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
                -d $(LIBDEST)/site-packages -f \
                -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
        -PYTHONPATH=$(DESTDIR)$(LIBDEST):$(DESTSHARED) $(RUNSHARED) \
                ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"

After doing so, you can 'make install'.

This is tested on OpenSUSE 10.3 with GCC 4.2.1.

----------
nosy: +spaceli

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue9631>
_______________________________________
History
Date User Action Args
2012-03-18 20:31:43miro_iliassetrecipients: + miro_ilias, loewis, orsenthil, eric.araujo, hozn, flox, dmalcolm, spprakash, Ari.Consul, asisco, eraonel, spaceli
2012-03-18 20:31:42miro_iliaslinkissue9631 messages
2012-03-18 20:31:41miro_iliascreate