How to make a static link of wxPython to Python2.6?

Hi all,

I got many errors like this one,

/root/dev/wxPython-src-2.8.11.0/wxPython/include/wx/wxPython/wxPython_int.h:65:24: error: wx/taskbar.h: No such file or directory

Anybody has idea?

What did you do to get to this point? (What commands are you running, etc.) What platform are you on? We can't read your mind, you need to tell us all the relevant details for us to be able to help you.

The error indicates that the compiler can not find the wx headers, or at least taskbar.h. Did you build and install wxWidgets? Is the wx-config that wxPython's build is using the correct one?

···

On 6/10/10 5:38 AM, 朱重八 wrote:

Hi all,
     I got many errors like this one,
/root/dev/wxPython-src-2.8.11.0/wxPython/include/wx/wxPython/wxPython_int.h:65:24:
error: wx/taskbar.h: No such file or directory

Anybody has idea?

--
Robin Dunn
Software Craftsman

Hi Robin,

Thanks so much for your answer! I am installing the wxPython by static linking according http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html, this is a instruction you written. Luckily, I solved this error by wx-config --cxxflags etc. So, I have finished the step 1 to step 4. The python build is successful.

Then, how to finish the step 5 in your instruction?

Please help me:) The platform is Linux.

Thanks again!

···

2010/6/11 Robin Dunn robin@alldunn.com

On 6/10/10 5:38 AM, 朱重八 wrote:

Hi all,

 I got many errors like this one,

/root/dev/wxPython-src-2.8.11.0/wxPython/include/wx/wxPython/wxPython_int.h:65:24:

error: wx/taskbar.h: No such file or directory

Anybody has idea?

What did you do to get to this point? (What commands are you running, etc.) What platform are you on? We can’t read your mind, you need to tell us all the relevant details for us to be able to help you.

The error indicates that the compiler can not find the wx headers, or at least taskbar.h. Did you build and install wxWidgets? Is the wx-config that wxPython’s build is using the correct one?

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

[[ This group prefers bottom-posting. Top Posting and Bottom Posting ]]

Hi Robin,
Thanks so much for your answer! I am installing the wxPython by static
linking according
http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html,
this is a instruction you written. Luckily, I solved this error by
wx-config --cxxflags etc. So, I have finished the step 1 to step 4. The
python build is successful.
Then, how to finish the step 5 in your instruction?
Please help me:) The platform is Linux.

For the record, we never really persued the static link idea beyond the state that it was in at the time of that message. The underlying need to do it went away when Apple released OSX 10.3 where the dynamic linking abilities and performance were greatly improved. Just curious, but why do you want to build Python this way?

I don't think I ever wrote the script for step 5, but it should just be a matter of copying the contents of wxPython/wx in the source tree to site-packages/wx in the installation location.

···

On 6/10/10 10:00 AM, 朱重八 wrote:

--
Robin Dunn
Software Craftsman

Hi Robin,

I want use freeze.py to distribute my wxpython program…so, I prepare to do the static link, according to the comments in http://wiki.python.org/moin/Freeze

In future, I would like also use freeze.py on Windows. Is this possible?

I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the freeze.py is more advanced and it uses different ways to generate the executable binaries than cx_Freeze and Pyinstaller, so I decide to use freeze.py.

Any suggestions to me?

Robin, thanks so much for your help.

···

2010/6/12 Robin Dunn robin@alldunn.com

[[ This group prefers bottom-posting. http://idallen.com/topposting.html ]]

On 6/10/10 10:00 AM, 朱重八 wrote:

Hi Robin,

Thanks so much for your answer! I am installing the wxPython by static

linking according

http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html,

this is a instruction you written. Luckily, I solved this error by

wx-config --cxxflags etc. So, I have finished the step 1 to step 4. The

python build is successful.

Then, how to finish the step 5 in your instruction?

Please help me:) The platform is Linux.

For the record, we never really persued the static link idea beyond the state that it was in at the time of that message. The underlying need to do it went away when Apple released OSX 10.3 where the dynamic linking abilities and performance were greatly improved. Just curious, but why do you want to build Python this way?

I don’t think I ever wrote the script for step 5, but it should just be a matter of copying the contents of wxPython/wx in the source tree to site-packages/wx in the installation location.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

在 2010年6月12日 下午1:19,朱重八 88pigs@gmail.com写道:

Hi Robin,
I want use freeze.py to distribute my wxpython program…so, I prepare to do the static link, according to the comments in http://wiki.python.org/moin/Freeze

In future, I would like also use freeze.py on Windows. Is this possible?

I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the freeze.py is more advanced and it uses different ways to generate the executable binaries than cx_Freeze and Pyinstaller, so I decide to use freeze.py.

Any suggestions to me?

Robin, thanks so much for your help.

Sorry, I should use bottom-posting…

在 2010年6月12日 下午1:27,朱重八 88pigs@gmail.com写道:

在 2010年6月12日 下午1:19,朱重八 88pigs@gmail.com写道:

Hi Robin,
I want use freeze.py to distribute my wxpython program…so, I prepare to do the static link, according to the comments in http://wiki.python.org/moin/Freeze

In future, I would like also use freeze.py on Windows. Is this possible?

I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the freeze.py is more advanced and it uses different ways to generate the executable binaries than cx_Freeze and Pyinstaller, so I decide to use freeze.py.

Any suggestions to me?

Robin, thanks so much for your help.

Sorry, I should use bottom-posting…

Hi Robin,

I encounter another problem, I copy the contents of wxPython/wx in the source tree to site-packages/wx, then I try to import wx in Python prompt, it shows me this:

import wx

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/lib/python2.6/site-packages/wx/init.py”, line 45, in

from wx._core import *

File “/usr/local/lib/python2.6/site-packages/wx/_core.py”, line 4, in

import core

ImportError: No module named core

All I have done is following the instructions of http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html.

I choose static link, so there is no core.so generated, so what to do next?

Thanks so much, Robin.

在 2010年6月13日 下午6:59,朱重八 88pigs@gmail.com写道:

在 2010年6月12日 下午1:27,朱重八 88pigs@gmail.com写道:

在 2010年6月12日 下午1:19,朱重八 88pigs@gmail.com写道:

Hi Robin,
I want use freeze.py to distribute my wxpython program…so, I prepare to do the static link, according to the comments in http://wiki.python.org/moin/Freeze

In future, I would like also use freeze.py on Windows. Is this possible?

I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the freeze.py is more advanced and it uses different ways to generate the executable binaries than cx_Freeze and Pyinstaller, so I decide to use freeze.py.

Any suggestions to me?

Robin, thanks so much for your help.

Sorry, I should use bottom-posting…

Hi Robin,

I encounter another problem, I copy the contents of wxPython/wx in the source tree to site-packages/wx, then I try to import wx in Python prompt, it shows me this:

import wx

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/lib/python2.6/site-packages/wx/init.py”, line 45, in

from wx._core import *

File “/usr/local/lib/python2.6/site-packages/wx/_core.py”, line 4, in

import core

ImportError: No module named core

All I have done is following the instructions of http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html.

I choose static link, so there is no core.so generated, so what to do next?

Thanks so much, Robin.

The Setup.local I used is attached, please check it.

Setup.local (31.1 KB)

I haven't built Python in this way in about 7 years, so I really don't
have much memory of what potential issues may be, or even if the current
Python still supports the Setup.local type of build. The only thing I
would be able to suggest at this point is to ensure that when you build
Python that it is also building the wxPython extension modules (like
_core_ mentioned above) and is linking them in to the Python executable.
If not then figure out why not and how to work around it.

From the bits and pieces that I do remember, the Python build process
takes the info in the Setup.local file and (in addition to generating
parts of the makefile) will generate a config.c file that has a table of
the names and function pointers to the builtin extension modules. My
guess is that the wxPython extension modules are not being added to that
table, otherwise you would get link errors or something.

···

On 6/13/10 4:06 AM, 朱重八 wrote:

在 2010年6月13日 下午6:59,朱重八 <88pigs@gmail.com
<mailto:88pigs@gmail.com>>写道:

    在 2010年6月12日 下午1:27,朱重八 <88pigs@gmail.com
    <mailto:88pigs@gmail.com>>写道:

        在 2010年6月12日 下午1:19,朱重八 <88pigs@gmail.com
        <mailto:88pigs@gmail.com>>写道:

            Hi Robin,
            I want use freeze.py to distribute my wxpython program...so,
            I prepare to do the static link, according to the comments
            in Freeze - Python Wiki
            In future, I would like also use freeze.py on Windows. Is
            this possible?
            I ever used the cx_Freeze, Pyinstaller, etc. But it seems
            that the freeze.py is more advanced and it uses different
            ways to generate the executable binaries than cx_Freeze and
            Pyinstaller, so I decide to use freeze.py.
            Any suggestions to me?
            Robin, thanks so much for your help.

        Sorry, I should use bottom-posting...

    Hi Robin,
    I encounter another problem, I copy the contents of wxPython/wx in
    the source tree to site-packages/wx, then I try to import wx in
    Python prompt, it shows me this:
    > >> import wx
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python2.6/site-packages/wx/__init__.py", line
    45, in <module>
    from wx._core import *
    File "/usr/local/lib/python2.6/site-packages/wx/_core.py", line 4,
    in <module>
    import _core_
    ImportError: No module named _core_

    All I have done is following the instructions of
    http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html.

    I choose static link, so there is no _core_.so generated, so what to
    do next?
    Thanks so much, Robin.

The Setup.local I used is attached, please check it.

--
Robin Dunn
Software Craftsman

IIRC all freeze.py does is generate C code that embeds the Python
byte-codes of the frozen modules. You then compile this code and link
with the Python interpreter code. This is essentially what tools like
py2exe are doing, except you don't need a C compiler, and the Python
interpreter runtime is dynamically linked. You are trying to take it
one step further by also static linking the wxPython extension modules,
however I really don't think there is that much advantage of doing that
these days since all the platforms are highly optimized to support
dynamic linking of shared libraries. Are you sure that all this pain is
worth the few percent saved in startup time?

···

On 6/11/10 10:27 PM, 朱重八 wrote:

在 2010年6月12日 下午1:19,朱重八 <88pigs@gmail.com
<mailto:88pigs@gmail.com>>写道:

    Hi Robin,
    I want use freeze.py to distribute my wxpython program...so, I
    prepare to do the static link, according to the comments in
    Freeze - Python Wiki
    In future, I would like also use freeze.py on Windows. Is this possible?
    I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the
    freeze.py is more advanced and it uses different ways to generate
    the executable binaries than cx_Freeze and Pyinstaller, so I decide
    to use freeze.py.

--
Robin Dunn
Software Craftsman

Hi Robin,
Thanks for your reply and help. I wrote a Python program, it has about 300 lines code. After compile it, I got a 20M package…dynamic links.

So… I tried the way of static link…

···

2010/6/15 Robin Dunn robin@alldunn.com

On 6/11/10 10:27 PM, 朱重八 wrote:

在 2010年6月12日 下午1:19,朱重八 <88pigs@gmail.com

mailto:88pigs@gmail.com>写道:

Hi Robin,
I want use freeze.py to distribute my wxpython program...so, I
prepare to do the static link, according to the comments in
[http://wiki.python.org/moin/Freeze](http://wiki.python.org/moin/Freeze)
In future, I would like also use freeze.py on Windows. Is this possible?
I ever used the cx_Freeze, Pyinstaller, etc. But it seems that the
freeze.py is more advanced and it uses different ways to generate
the executable binaries than cx_Freeze and Pyinstaller, so I decide
to use freeze.py.

IIRC all freeze.py does is generate C code that embeds the Python

byte-codes of the frozen modules. You then compile this code and link

with the Python interpreter code. This is essentially what tools like

py2exe are doing, except you don’t need a C compiler, and the Python

interpreter runtime is dynamically linked. You are trying to take it

one step further by also static linking the wxPython extension modules,

however I really don’t think there is that much advantage of doing that

these days since all the platforms are highly optimized to support

dynamic linking of shared libraries. Are you sure that all this pain is

worth the few percent saved in startup time?