How to Build and Install wxPython for Microsoft Windows under Cygwin
Introduction
This procedure produces a version of wxPython that works with the Cygwin build of Python 2.5 (using the Cygwin C runtime library) and uses native Windows graphics (i.e., direct GDI calls, not X-windows). This combination is intended to work with a Cygwin version of GNU Radio (one that also uses the Cygwin C runtime library). The combination of Cygwin libraries and native MSW graphics is not directly supported by the wxPython build system but can be accommodated with minor changes.
These instructions are current as of June 2008 and assume you are using wxPython 2.8.7.1, Cygwin binutils 20060817-1, and current versions of other Cygwin tools and libraries.
Step-by-Step Instructions.
Feel free to modify this recipe to suit your preferences:
(1) Download the wxWidgets and wxPython source code from wxPython-src link at http://www.wxpython.org/download.php#sources to /usr/src.
(2) Unpack the source distribution:
cd /usr/src tar -jxf wxPython-src-2.8.7.1.tar.bz2
This will create the directory /usr/src/wxPython-src-2.8.7.1. For convenience (especially if you want to put your code somewhere else) I will call this directory $WXDIR in what follows.
(3) Create a build directory:
cd $WXDIR mkdir build-local
Choose any name for your build directory; I use build-local here.
(4) Configure wxWidgets:
cd $WXDIR/build-local ../configure --with-msw
(5) Compile and link wxWidgets:
cd $WXDIR/build-local make make -C contrib/src/stc
You may do make -C contrib/src/gizmos to compile and link the gizmos package. The gizmos package has some fun tools for developing Python programs but is not required for GNU Radio.
(6) Install wxWidgets:
cd $WXDIR/build-local make install make -C contrib/src/stc install
This installs the wxWidgets DLLs in /usr/local/lib. If you compiled the gizmos package, install it with make -C contrib/src/gizmos install.
Depending on how you installed Cygwin, you might get an error like
/usr/bin/install -c -d /usr/local/lib /usr/bin/install: cannot change permissions of `/usr/local/lib': Permission denied
You can fix this by changing /usr/local/lib and /usr/local/bin to give you ownership of these directories. See the instructions in hints, tips, known problems, and solutions for Windows.
(7) Move the DLLs to /usr/local/bin:
mv /usr/local/lib/cygwx*.dll /usr/local/bin
Unless /usr/local/lib is in your PATH, it is easier to have the DLLs in /usr/local/bin. (If you know how to make the configure/build process do this for you, please let me know.)
(8) Test the build and installation of wxWidgets:
cd $WXDIR/build-local/samples/minimal make ./minimal.exe
This should produce a small window to prove that wxWidgets works.
(9) Build wxPython:
cd $WXDIR/wxPython python setup.py build_ext --inplace WXPORT=msw COMPILER=cygwin BUILD_GLCANVAS=0 BUILD_GIZMOS=0 UNICODE=0
This builds the Python connection to wxWidgets. If you built gizmos you should omit the BUILD_GIZMOS=0 flag.
You may get the error
ValueError: invalid version number '2.18.50.20080523'
if you are using binutils 20080523-1. In that case you will need to either reinstall binutils 20060817-1 or make corrections in your Python installation; see hints, tips, known problems, and solutions for Windows.
(10) Install wxPython:
cd $WXDIR/wxPython python setup.py install WXPORT=msw COMPILER=cygwin BUILD_GLCANVAS=0 BUILD_GIZMOS=0 UNICODE=0
This installs wxPython. If you build gizmos you should omit the BUILD_GIZMOS=0 flag.
(11) Test your wxPython installation:
cd $WXDIR/wxPython/demo python demo.py
This should present you with a green snake (and a window showing what wxPython can do). If this works, you are done. With
export PYTHONPATH=/usr/lib/python2.5/site-packages
you should be able to "import wx", build gr-wxgui, and "import wxgui".
If demo.py doesn't work your version of Cygwin may be out of date (see hints, tips, known problems, and solutions for Windows).
Notes
- The patch in statbmp.patch is not needed with wxPython 2.8.0.1 or later
- The patches in config.patch and treelistctrl.cpp.patch are not needed with wxPython 2.8.7.1
Attachments
- statbmp.patch (1.5 kB) -
statbmp patch for wxWidgets on Cygwin
, added by don2387ward@sprynet.com on 08/25/06 18:04:14. - config.patch (0.6 kB) -
patch file for wxPython config.py on Cygwin
, added by don2387ward@sprynet.com on 08/25/06 18:25:21. - treelistctrl.cpp.patch (430 bytes) -
patch for gizmos/wxCode/src/treelistctrl.cpp for wxPython 2.8.0.1
, added by dward on 12/31/06 14:58:37.
