Title: Frozen programs require the original build directory in order to run.
Type: behavior Stage: needs patch
Components: Demos and Tools Versions: Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, malcolmp
Priority: normal Keywords:

Created on 2011-09-20 01:44 by malcolmp, last changed 2011-10-17 15:53 by eric.araujo.

Messages (2)
msg144315 - (view) Author: Malcolm Purvis (malcolmp) Date: 2011-09-20 01:44
In Python 2.7.2, Linux executables built with will only run on the machine that contains the original build directory.  This defeats the purpose of having frozen programs.  This problem did not exist in Python 2.5.

The following steps reproduce the problem:

1) Build a copy of python:

$ tar -xf Python-2.7.2.tar.bz2
$ cd Python-2.7.2
$ ./configure --prefix=`pwd`/install
$ make
$ make install

2) In another directory, build a frozen program:

$ echo 'print "Hello World"' >
$ ~/src/Python-2.7.2/python ~/src/Python-2.7.2/Tools/freeze/
$ make
$  ./hello 
Hello World

Copy the binary to another machine:

$ $ ./hello 
Traceback (most recent call last):
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 563, in <module>
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 545, in main
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 278, in addusersitepackages
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 253, in getusersitepackages
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 243, in getuserbase
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 520, in get_config_var
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 419, in get_config_vars
  File "/home/malcolmp/src/Python-2.7.2/Lib/", line 287, in _init_posix
IOError: invalid Python installation: unable to open /home/malcolmp/src/Python-2.7.2/install/lib/python2.7/config/Makefile (No such file or directory)
msg145718 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2011-10-17 15:53
Thanks for the report.  In 2.7 and 3.2, Python initialization was changed to use the new sysconfig module, which depends on the sysconfig.cfg file.  freeze needs to special-case the sysconfig module in its detection code to include the cfg file.

Do you want to work on a patch?
Date User Action Args
2011-10-17 15:53:35eric.araujosetnosy: + eric.araujo

messages: + msg145718
stage: needs patch
2011-09-20 01:44:50malcolmpcreate