I've compiled my wxPython application using freeze.py, which is released in Python sources. The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
The compilation succeeded, but I've a problem to run it. Some libs were lacking after compilation, so I've copied them (_gdi_.so, _misc_.so, _windows_.so, _controls_.so, _core_.so) to the same directory as my compiled binary. Now, all needed modules are available (no more warnings/errors at startup).
But there is a segmentation fault at startup. It occurs when the method init_gdi_() is called. Here is the gdb backtrace of the segfault :
···
-------------------------------------------------------------------------- #0 0xb6609611 in init_gdi_ () from /home/lionel/Python/compil/freeze/test/_gdi_.so #1 0x080b2bb4 in _PyImport_LoadDynamicModule () #2 0x080b0894 in ?? () #3 0x080b0ad8 in ?? () #4 0x080b1017 in ?? () #5 0x080b11d5 in ?? () #6 0x080b1677 in PyImport_ImportModuleLevel () #7 0x081216b4 in ?? () #8 0x080dc667 in PyObject_Call () #9 0x08092d3c in PyEval_CallObjectWithKeywords () #10 0x080965f7 in PyEval_EvalFrameEx () #11 0x0809b097 in PyEval_EvalCodeEx () #12 0x0809b1e7 in PyEval_EvalCode () #13 0x080afd1c in PyImport_ExecCodeModuleEx () #14 0x080affa4 in PyImport_ImportFrozenModule () #15 0x080b082e in ?? () #16 0x080b0ad8 in ?? () #17 0x080b0f97 in ?? () #18 0x080b11d5 in ?? () #19 0x080b1677 in PyImport_ImportModuleLevel () #20 0x081216b4 in ?? () #21 0x080dc667 in PyObject_Call () #22 0x08092d3c in PyEval_CallObjectWithKeywords () #23 0x080965f7 in PyEval_EvalFrameEx () #24 0x0809b097 in PyEval_EvalCodeEx () #25 0x0809b1e7 in PyEval_EvalCode () #26 0x080afd1c in PyImport_ExecCodeModuleEx () #27 0x080affa4 in PyImport_ImportFrozenModule () #28 0x080b082e in ?? () #29 0x080b0ad8 in ?? () #30 0x080b0f97 in ?? () #31 0x080b1216 in ?? () #32 0x080b1677 in PyImport_ImportModuleLevel () #33 0x081216b4 in ?? () #34 0x080dc667 in PyObject_Call () #35 0x08092d3c in PyEval_CallObjectWithKeywords () #36 0x080965f7 in PyEval_EvalFrameEx () #37 0x0809b097 in PyEval_EvalCodeEx () #38 0x0809b1e7 in PyEval_EvalCode () #39 0x080afd1c in PyImport_ExecCodeModuleEx () #40 0x080affa4 in PyImport_ImportFrozenModule () #41 0x080b082e in ?? () #42 0x080b0ad8 in ?? () #43 0x080b0f97 in ?? () #44 0x080b11d5 in ?? () #45 0x080b1677 in PyImport_ImportModuleLevel () #46 0x081216b4 in ?? () #47 0x080dc667 in PyObject_Call () #48 0x08092d3c in PyEval_CallObjectWithKeywords () #49 0x080965f7 in PyEval_EvalFrameEx () #50 0x0809b097 in PyEval_EvalCodeEx () #51 0x0809b1e7 in PyEval_EvalCode () #52 0x080afd1c in PyImport_ExecCodeModuleEx () #53 0x080affa4 in PyImport_ImportFrozenModule () #54 0x080aa0fd in Py_FrozenMain () #55 0x08059e1c in main ()
--------------------------------------------------------------------------
Any ideas ?
Have you ever try to compile wxPython applications with Freeze or another Python compiler ?
<div class="moz-text-flowed" style="font-family: -moz-fixed">Hi all,
I've compiled my wxPython application using freeze.py, which is released in Python sources. The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
The compilation succeeded, but I've a problem to run it. Some libs were lacking after compilation, so I've copied them (_gdi_.so, _misc_.so, _windows_.so, _controls_.so, _core_.so) to the same directory as my compiled binary. Now, all needed modules are available (no more warnings/errors at startup).
But there is a segmentation fault at startup. It occurs when the method init_gdi_() is called. Here is the gdb backtrace of the segfault :
#0 0xb6609611 in init_gdi_ () from /home/lionel/Python/compil/freeze/test/_gdi_.so #1 0x080b2bb4 in _PyImport_LoadDynamicModule () #2 0x080b0894 in ?? () #3 0x080b0ad8 in ?? () #4 0x080b1017 in ?? () #5 0x080b11d5 in ?? () #6 0x080b1677 in PyImport_ImportModuleLevel () #7 0x081216b4 in ?? () #8 0x080dc667 in PyObject_Call () #9 0x08092d3c in PyEval_CallObjectWithKeywords () #10 0x080965f7 in PyEval_EvalFrameEx () #11 0x0809b097 in PyEval_EvalCodeEx () #12 0x0809b1e7 in PyEval_EvalCode () #13 0x080afd1c in PyImport_ExecCodeModuleEx () #14 0x080affa4 in PyImport_ImportFrozenModule () #15 0x080b082e in ?? () #16 0x080b0ad8 in ?? () #17 0x080b0f97 in ?? () #18 0x080b11d5 in ?? () #19 0x080b1677 in PyImport_ImportModuleLevel () #20 0x081216b4 in ?? () #21 0x080dc667 in PyObject_Call () #22 0x08092d3c in PyEval_CallObjectWithKeywords () #23 0x080965f7 in PyEval_EvalFrameEx () #24 0x0809b097 in PyEval_EvalCodeEx () #25 0x0809b1e7 in PyEval_EvalCode () #26 0x080afd1c in PyImport_ExecCodeModuleEx () #27 0x080affa4 in PyImport_ImportFrozenModule () #28 0x080b082e in ?? () #29 0x080b0ad8 in ?? () #30 0x080b0f97 in ?? () #31 0x080b1216 in ?? () #32 0x080b1677 in PyImport_ImportModuleLevel () #33 0x081216b4 in ?? () #34 0x080dc667 in PyObject_Call () #35 0x08092d3c in PyEval_CallObjectWithKeywords () #36 0x080965f7 in PyEval_EvalFrameEx () #37 0x0809b097 in PyEval_EvalCodeEx () #38 0x0809b1e7 in PyEval_EvalCode () #39 0x080afd1c in PyImport_ExecCodeModuleEx () #40 0x080affa4 in PyImport_ImportFrozenModule () #41 0x080b082e in ?? () #42 0x080b0ad8 in ?? () #43 0x080b0f97 in ?? () #44 0x080b11d5 in ?? () #45 0x080b1677 in PyImport_ImportModuleLevel () #46 0x081216b4 in ?? () #47 0x080dc667 in PyObject_Call () #48 0x08092d3c in PyEval_CallObjectWithKeywords () #49 0x080965f7 in PyEval_EvalFrameEx () #50 0x0809b097 in PyEval_EvalCodeEx () #51 0x0809b1e7 in PyEval_EvalCode () #52 0x080afd1c in PyImport_ExecCodeModuleEx () #53 0x080affa4 in PyImport_ImportFrozenModule () #54 0x080aa0fd in Py_FrozenMain () #55 0x08059e1c in main ()
--------------------------------------------------------------------------
Any ideas ?
Have you ever try to compile wxPython applications with Freeze or another Python compiler ?
Thanks,
It would be good to know which system(s) you are compiling for (i.e. Windows, Linux, Mac). I only compile for Windows and I use GUI2Exe, which is a wrapper for py2exe that works quite well. I have had issues with not having certain dlls, but I can include those easily enough using Inno Setup.
<div class="moz-text-flowed" style="font-family: -moz-fixed">Hi all,
I've compiled my wxPython application using freeze.py, which is released in Python sources. The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
The compilation succeeded, but I've a problem to run it. Some libs were lacking after compilation, so I've copied them (_gdi_.so, _misc_.so, _windows_.so, _controls_.so, _core_.so) to the same directory as my compiled binary. Now, all needed modules are available (no more warnings/errors at startup).
But there is a segmentation fault at startup. It occurs when the method init_gdi_() is called. Here is the gdb backtrace of the segfault :
#0 0xb6609611 in init_gdi_ () from /home/lionel/Python/compil/freeze/test/_gdi_.so #1 0x080b2bb4 in _PyImport_LoadDynamicModule () #2 0x080b0894 in ?? () #3 0x080b0ad8 in ?? ()
(...) #52 0x080afd1c in PyImport_ExecCodeModuleEx () #53 0x080affa4 in PyImport_ImportFrozenModule () #54 0x080aa0fd in Py_FrozenMain () #55 0x08059e1c in main ()
--------------------------------------------------------------------------
Any ideas ?
Have you ever try to compile wxPython applications with Freeze or another Python compiler ?
Thanks,
It would be good to know which system(s) you are compiling for (i.e. Windows, Linux, Mac). I only compile for Windows and I use GUI2Exe, which is a wrapper for py2exe that works quite well. I have had issues with not having certain dlls, but I can include those easily enough using Inno Setup.
I really should write a tutorial on this...
Mike
I'm compiling for Linux. My application is multi-OS, but I want to
compile for Linux first. For the moment I don't need to compile for
Windows, Py2exe works well .
Is there a visible gain (size, memory and CPU) between application
compiled with gui2exe and py2exe ?
<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll a écrit :
Lionel NICOLAS wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Hi all,
I've compiled my wxPython application using freeze.py, which is released in Python sources. The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
The compilation succeeded, but I've a problem to run it. Some libs were lacking after compilation, so I've copied them (_gdi_.so, _misc_.so, _windows_.so, _controls_.so, _core_.so) to the same directory as my compiled binary. Now, all needed modules are available (no more warnings/errors at startup).
But there is a segmentation fault at startup. It occurs when the method init_gdi_() is called. Here is the gdb backtrace of the segfault :
<snip>
It would be good to know which system(s) you are compiling for (i.e. Windows, Linux, Mac). I only compile for Windows and I use GUI2Exe, which is a wrapper for py2exe that works quite well. I have had issues with not having certain dlls, but I can include those easily enough using Inno Setup.
I really should write a tutorial on this...
Mike
I'm compiling for Linux. My application is multi-OS, but I want to
compile for Linux first. For the moment I don't need to compile for
Windows, Py2exe works well .
Is there a visible gain (size, memory and CPU) between application
compiled with gui2exe and py2exe ?
I doubt this makes any difference since gui2exe is just a GUI interface to py2exe. Basically, it allows you to pass all the resources and switches to py2exe by clicking on checkboxes or adding file paths. It also generates a setup.py file that you can export and (I think) use with py2exe without the gui. If I recall correctly, I think PyInstaller might make a marginally smaller binary.
I hope so too. It may have to wait a while since it's been really hot and humid here and I don't enjoy my computer in that sort of weather...which is one of the primary reasons my blog has been dead as of late...I really should invest in some A/C.
I've compiled my wxPython application using freeze.py, which is released in Python sources.
The freeze.py script is fairly ancient and probably hasn't had much updating in a very long time. I would stick with one of the actively maintained tools that others have mentioned. They will better handle dependencies, both external python modules and also binary dependencies like extension modules and shared libraries.
The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
This is not true. The only thing that freeze does is take the python byte-code and write out the bytes in a format that can be compiled with a C compiler. At runtime it is still Python byte code which is being interpreted with the Python interpreter (which also happens to be linked into the same executable.) There will be almost no difference between that and running the standard Python with .pyc files. The other tools like py2exe, pyinstaller and etc. are all basically doing the same thing, but are assembling the executable directly instead of making you use a C compiler .
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I've compiled my wxPython application using freeze.py, which is released in Python sources.
The freeze.py script is fairly ancient and probably hasn't had much updating in a very long time. I would stick with one of the actively maintained tools that others have mentioned. They will better handle dependencies, both external python modules and also binary dependencies like extension modules and shared libraries.
I'll try other utilities. The problem is that my application is separated in many scripts. For example, cx_Freeze don't really like this type of application, but Freeze seems to work with it (it compile all scripts dependencies).
I think I will try to compile one by one all my scripts and put them into the same directory to see what happens
The reason of this is to have a single binary for my application, and improve performance (compiled instead of interpreted).
This is not true. The only thing that freeze does is take the python byte-code and write out the bytes in a format that can be compiled with a C compiler. At runtime it is still Python byte code which is being interpreted with the Python interpreter (which also happens to be linked into the same executable.) There will be almost no difference between that and running the standard Python with .pyc files. The other tools like py2exe, pyinstaller and etc. are all basically doing the same thing, but are assembling the executable directly instead of making you use a C compiler .
...
I'll try other utilities. The problem is that my application is separated in many scripts. For example, cx_Freeze don't really like this type of application, but Freeze seems to work with it (it compile all scripts dependencies).
I think I will try to compile one by one all my scripts and put them into the same directory to see what happens
py2exe can handle multiple scripts, i.e. generate more then one exe with one setup.py.