Build PySWT Toolchain under windows

  1. Download and install Python 2.4 on C:\Python24 from
  2. Copy Python24.dll from \Windows\System32 to C:\Python24\libs if it is not there.
  3. Download and install MSYS (MSYS-1.0.10.exe) on C:\msys\ from
  4. Download and install MinGW? (MinGW?-4.1.1.exe) on C:\MinGW?\ from The following components have to been installed:
    • runtime, w32api, binutil
    • gcc-core, gcc-g++, gcc-java
    • mingw32-make
  5. Mount MinGW? and Python in MSYS
    • start "MinGW?->MSYS->msys"
    • echo "C:/MinGW? /mingw" > /etc/fstab
    • echo "C:/Python24 /python" >> /etc/fstab
  6. Download and install libiconv (libiconv-1.9.2.tar.gz) from by libgcj)
    • tar zxvf libiconv-1.9.2.tar.gz
    • cd libiconv-1.9.2
    • ./configure --prefix=/mingw --enable-static=yes --enable-shared=no
    • make
    • make install
  7. Download and Install SIP (sip-4.2.1.tar.gz) from (note, sip-4.2.1.tar.gz is not available on their website since sip 4.3 is out, but you can download from
    • start a "command prompt" window
    • set PATH=c:\Python24;c:\MinGW?\bin;\%PATH\% (add python, mingw/bin into path)
    • python -k -p win32-g++ AR="ar rcs" (add -k for building SIP as static library)
    • mingw32-make
    • mingw32-make install

Build PySWT under windows

  1. Prepare environment
    • start "MinGW?->MSYS->msys"
    • export PATH=/c/Python24:$PATH (add python into PATH or you can add it into /etc/profile)
  2. Download and untar PySWT-xxx-src.tar.gz
    • tar zxvf pyswt-xxx-src.tar.gz
  3. Download from, unzip it and then unzip into jswt/
  4. Build libswt.a
    • cd pyswt-xxx/jswt
    • python java (patch some SWT java files)
    • make noawt (remove org/eclipse/swt/awt directories)
    • make static
  5. Generate SWT Header files
    • make headers (Do multiple time)
    • python header (patch some SWT header files)
  6. Build jsip
    • cd pyswt-xxx/jsip
    • python
    • mingw32-make
    • cp jsip.exe /c/Python24
  7. Generate PySWT source files
    • cd pyswt-xxx/sip
    • make win32
  8. Build pyswt.pyd
    • cd pyswt-xxx/src
    • python
    • mingw32-make
  9. Install pyswt
    • copy pyswt.pyd to c:\python24\Lib\site-packages
    • copy swt-win32-3138.dll, swt-gdip-3138.dll (swt-awt-win32-3138.dll if you didn't remove awt/ directory in swt source codes) to some directory in system, say C:\Windows\System32.
  10. Run sample
    • cd pyswt-xxx/samples
    • python


   flex -olexer.c lexer.l
  • generate parser.h parser.c
   bison -d -oparser.c parser.y

    /* The sip module will be builtin. */
	extern void initsip(void);

    struct _inittab builtin_modules[] = {
		{"sip", initsip},

  • pass static=1 when generate Makefile (-DSIP_STATIC_MODULE in Makefile)

Valid XHTML 1.0! Valid CSS!