wam at cisco.com
Tue Mar 11 16:51:47 CET 2008
On Sun, 2008-03-09 at 14:31 -0400, Mark Erbaugh wrote:
> I'm using cxFreeze 3.0.3 to create frozen executables of a Python
> application I am developing. I've created frozen executables for both
> Linux and Windows. I have questions about both:
> Windows: Is there a way to use a custom icon rather than the generic
> Windows program icon?
Personally, whenever I've needed to have a compiled executable under
Windows, I've used either py2exe (http://www.py2exe.org/) or PyInstaller
(http://pyinstaller.python-hosting.com/), both work great and support
customizable icons being configured in the settings.py file or on the
commandline. I'm slightly more partial to py2exe myself, but if you need
Linux support, you should look into PyInstaller. cxFreeze certainly
isn't a *bad* option, it's just lacking in features. For example, with
your case, it doesn't appear as if cx_Freeze has the selectable icon
feature though. There are plenty of resource editors available under
windows that would allow you to modify the content of your
resulting .exe to replace the icon (google for 'change windows exe
icon') after the fact though.
> Linux: It looks like cxFreeze is missing a couple of libraries,
> libpython2.4.so.1.0 and libpq.so.4 (psycopg2 / PostgreSQL)
Adding --shared-lib-name /usr/lib/libpython2.4.so.1.0
to your FreezePython invocation should help take care of the first
problem. Handling the second issue is harder. cxFreeze doesn't try to
resolve all system dependencies in it's bundle. You'll notice that it
doesn't stick in any of the other shared libraries your executables
depend upon either (e.g. libpthread.so). My best advice would be to
manually copy over the libpq.so.4 shared library, and in your main
routine modify your process'es LD_LIBRARY_PATH environment to include
your install directory *prior to importing psycopg2*. I've not tested
this, but it *might* work.
> I developed and froze the Linux version of the application on a
> workstation running Ubuntu Dapper and Python2.4, but I tried to run on
> machine with Gutsy and Python2.5. I deliberately did not install
> Python2.4 because I would like my application to run on any Linux box.
Well, cxFreeze is generally pretty good about resolving python
dependencies. Other system dependencies like a postgress runtime are
kind of hit or miss.
> To get it working on the Gutsty workstation, I copied the missing files
> from my Dapper workstation (/usr/lib) into the same directory as the
> frozen executable. I then had to run ldconfig and add that directory to
> the cache. Is there another way to have those files recognized. I'd
> really like to be able to just copy and unzip an archive file to a new
> Linux box - which is what I can do with the Windows version.
You shouldn't have to run ldconfig on your install host. Unless you're
running your executable setuid, you should be able to manipulate your
environment variables to define LD_LIBRARY_PATH to be a colon seperated
list of directories to look for (in addition to the system directories)
shared libraries. For a full list of environment variables honored by
the shared library machinery, read the manpage for 'ld.so'
More information about the CentralOH