Unable to get bootloader rebuild fix to address GLIBC version problem

443 views
Skip to first unread message

Paul Whipp

unread,
Feb 29, 2012, 2:18:37 AM2/29/12
to pyins...@googlegroups.com

My goal is to produce a portable executable that will run on glibc 2.5 and newer Linux systems. My local version of Glib is 2.11.1 so…

As advised I've moved to the development version of pyinstaller (using pyinstaller-pyinstaller-d9bfa9a.tar.gz from pyinstaller.org).

Next I follow the instructions from http://www.pyinstaller.org/wiki/FAQ Namely

Under Linux, I get runtime dynamic linker errors, related to libc. What should I do? The executable that PyInstaller builds is not fully static, in that it still depends on the system libc. Under Linux, the ABI of GLIBC is backward compatible, but not forward compatible. So if you link against a newer GLIBC, you can't run the resulting executable on an older system. The solution is to compile the bootloader on the oldest system you have around, so that it gets linked with the oldest version of GLIBC. Then, you can copy the bootloader binaries (support/loader/*) into your development system and run Build.py there.

This takes me to the appendix in the manual titled "Building the bootloaders"

To build the bootloaders on a suitably old system, I kick off a new clean Centos 5.4 32 bit instance on EC2 using the ami-efe4cf9b AMI.

I run through the bootloader instructions and create a new set of bootloaders thus:

[root@ip-10-227-131-79 ~]# python -V
Python 2.4.3
[root@ip-10-227-131-79 ~]# /lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.

[root@ip-10-227-131-79 ~]# tar -xzf lsb-sdk-4.1.2-1.ia32.tar.gz 
[root@ip-10-227-131-79 ~]# cd lsb-sdk
[root@ip-10-227-131-79 lsb-sdk]# ./install.sh

This system appears to be a RPM-based distribution, such as those from
Red Hat, SuSE/Novell, Mandriva, Asianux, etc.

Is this correct? y

Installing packages...
There may have been problems with the package installation.  Check
error-log.txt for more information.
[root@ip-10-227-131-79 lsb-sdk]# cat error-log.txt 
warning: lsb-build-base-4.1.4-1.i486.rpm: Header V4 DSA signature: NOKEY, key ID bdc76b46
warning: lsb-xdg-utils-4.0.0-2.i486.rpm: Header V4 DSA signature: NOKEY, key ID 44facb2f

[root@ip-10-227-131-79 ~]# tar -xzf pyinstaller-pyinstaller-d9bfa9a.tar.gz 
[root@ip-10-227-131-79 ~]# mv pyinstaller-pyinstaller-d9bfa9a pyinstaller


[root@ip-10-227-131-79 ~]# yum groupinstall "Development Tools"
<output deleted>
Complete!
[root@ip-10-227-131-79 ~]# yum install python-devel
<output deleted>                  
Complete!

[root@ip-10-227-131-79 ~]# cd pyinstaller
[root@ip-10-227-131-79 pyinstaller]# cp -a support/loader/Linux-32bit support/loader/Linux-32bit.bak
[root@ip-10-227-131-79 pyinstaller]# cd source
[root@ip-10-227-131-79 source]# python waf configure build install
Linux-32bit detected 
Building LSB bootloader. 
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for program python              : /usr/bin/python 
Checking for Python version              : 2.4.3 
Checking for library python2.4           : yes 
Checking for program python2.4-config    : not found 
Checking for program python-config-2.4   : not found 
Checking for custom code                 : yes 
Checking for program lsbcc               : not found 
Checking for program /opt/lsb/bin/lsbcc  : /opt/lsb/bin/lsbcc 
Checking for LSB build tools >= 4.0      : yes 
Checking for library z                   : yes 
Checking for function readlink           : yes 
Checking for flags -m32                  : yes 
Checking for flags -Wl,--as-needed       : yes 
'configure' finished successfully (1.350s)
Waf: Entering directory `/root/pyinstaller/source/build'
[ 1/20] cc: linux/getpath.c -> build/debug/linux/getpath_1.o
warning: dangerous include path /usr/include/python2.4
[ 2/20] cc: linux/utils.c -> build/debug/linux/utils_1.o
warning: dangerous include path /usr/include/python2.4
[ 3/20] cc: common/main.c -> build/debug/common/main_1.o
warning: dangerous include path /usr/include/python2.4
[ 4/20] cc: common/launch.c -> build/debug/common/launch_1.o
warning: dangerous include path /usr/include/python2.4
[ 5/20] cc: linux/getpath.c -> build/release/linux/getpath_2.o
warning: dangerous include path /usr/include/python2.4
[ 6/20] cc: linux/utils.c -> build/release/linux/utils_2.o
warning: dangerous include path /usr/include/python2.4
[ 7/20] cc: common/main.c -> build/release/common/main_2.o
warning: dangerous include path /usr/include/python2.4
[ 8/20] cc: common/launch.c -> build/release/common/launch_2.o
warning: dangerous include path /usr/include/python2.4
[ 9/20] cc: linux/getpath.c -> build/releasew/linux/getpath_3.o
warning: dangerous include path /usr/include/python2.4
[10/20] cc: linux/utils.c -> build/releasew/linux/utils_3.o
warning: dangerous include path /usr/include/python2.4
[11/20] cc: common/main.c -> build/releasew/common/main_3.o
warning: dangerous include path /usr/include/python2.4
[12/20] cc: common/launch.c -> build/releasew/common/launch_3.o
warning: dangerous include path /usr/include/python2.4
[13/20] cc: linux/getpath.c -> build/debugw/linux/getpath_4.o
warning: dangerous include path /usr/include/python2.4
[14/20] cc: linux/utils.c -> build/debugw/linux/utils_4.o
warning: dangerous include path /usr/include/python2.4
[15/20] cc: common/main.c -> build/debugw/common/main_4.o
warning: dangerous include path /usr/include/python2.4
[16/20] cc: common/launch.c -> build/debugw/common/launch_4.o
warning: dangerous include path /usr/include/python2.4
[17/20] cc_link: build/debug/linux/getpath_1.o build/debug/linux/utils_1.o build/debug/common/main_1.o build/debug/common/launch_1.o -> build/debug/run_d
[18/20] cc_link: build/release/linux/getpath_2.o build/release/linux/utils_2.o build/release/common/main_2.o build/release/common/launch_2.o -> build/release/run
[19/20] cc_link: build/releasew/linux/getpath_3.o build/releasew/linux/utils_3.o build/releasew/common/main_3.o build/releasew/common/launch_3.o -> build/releasew/runw
[20/20] cc_link: build/debugw/linux/getpath_4.o build/debugw/linux/utils_4.o build/debugw/common/main_4.o build/debugw/common/launch_4.o -> build/debugw/runw_d
Waf: Leaving directory `/root/pyinstaller/source/build'
'build' finished successfully (4.153s)
Waf: Entering directory `/root/pyinstaller/source/build'
\* installing build/debug/run_d as ../../support/loader/Linux-32bit/run_d
\* installing build/release/run as ../../support/loader/Linux-32bit/run
\* installing build/releasew/runw as ../../support/loader/Linux-32bit/runw
\* installing build/debugw/runw_d as ../../support/loader/Linux-32bit/runw_d
Waf: Leaving directory `/root/pyinstaller/source/build'
'install' finished successfully (0.117s)

I bundle up Linux-32bit loaders and move them to my development system replacing the files that are there. Then I repeat the exe build

~/python/orb/merchant $ python pyinstaller/pyinstaller.py -F orb_development_proxy.py
INFO: wrote /home/paul/python/orb/merchant/orb_development_proxy.spec
INFO: UPX is not available.
INFO: checking Analysis
INFO: building Analysis because out00-Analysis.toc non existent
INFO: running Analysis out00-Analysis.toc
INFO: Analyzing /home/paul/python/orb/merchant/pyinstaller/support/_pyi_bootstrap.py
INFO: Analyzing orb_development_proxy.py
INFO: Hidden import 'encodings' has been found otherwise
INFO: Warnings written to /home/paul/python/orb/merchant/build/pyi.linux2/orb_development_proxy/warnorb_development_proxy.txt
INFO: checking PYZ
INFO: rebuilding out01-PYZ.toc because out01-PYZ.pyz is missing
INFO: building PYZ out01-PYZ.toc
INFO: checking PKG
INFO: rebuilding out03-PKG.toc because out03-PKG.pkg is missing
INFO: building PKG out03-PKG.pkg
INFO: checking EXE
INFO: rebuilding out02-EXE.toc because orb_development_proxy missing
INFO: building EXE from out02-EXE.toc
INFO: Appending archive to EXE /home/paul/python/orb/merchant/dist/orb_development_proxy
~/python/orb/merchant $ ls

Now I take that executable (which works fine on the dev system) to the 5.4 environment:

~ $ orb_development_proxy ping merchant merchant
Error loading Python lib '/tmp/_MEIgmrbBu/libpython2.6.so.1.0': /lib/libc.so.6: version `GLIBC_2.7' not found (required by /tmp/_MEIgmrbBu/libcrypto.so.0.9.8)

Doh. It appears that rebuilding the bootloaders as documented does not in any way help with this GLIBC version problem whether on the development or release build of pyinstaller. Am I still doing something wrong?

Cheers,
Paul

Hartmut Goebel

unread,
Feb 29, 2012, 3:42:01 AM2/29/12
to pyins...@googlegroups.com
Am 29.02.2012 08:18, schrieb Paul Whipp:
>
> I bundle up Linux-32bit loaders and move them to my development system
> replacing the files that are there. Then I repeat the exe build
>

This is the error in your process: You need to build the exe on the
Centos 5.4 machine too.

The reason: Not only the boot loader depends on glibc, but also other
shared libs, esp. libpython.

--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de


Paul Whipp

unread,
Feb 29, 2012, 4:15:26 AM2/29/12
to pyins...@googlegroups.com
OK. That is not what is implied by the documentation which says I can copy the bootloader files onto my development system (which I did).

It means I'll have to figure out how to get Python 2.6.5 to behave on the Centos system which relies heavily on Python 2.4.

Hartmut Goebel

unread,
Feb 29, 2012, 5:20:44 AM2/29/12
to pyins...@googlegroups.com
Am 29.02.2012 10:15, schrieb Paul Whipp:
> OK. That is not what is implied by the documentation which says I can
> copy the bootloader files onto my development system (which I did).
So we need to update the doc. You are welcome to submit a patch.

> It means I'll have to figure out how to get Python 2.6.5 to behave on
> the Centos system which relies heavily on Python 2.4.

Simply install Python 2.6.5 into /usr/local or some other prefix.

Compiling Python is easy in most cases. If you are using stuff like ssl,
you may need to install some devel-rpms.

Reply all
Reply to author
Forward
0 new messages