Open-source tools for Cygwin on Windows

Magic, XCircuit, IRSIM, Netgen, and PCB are all capable of running under Windows. However, the graphics of all except netgen (which is not a graphics program) are based on X11, the UNIX-based graphics environment, which not compatible with Windows API. Also signalling, system calls, etc., etc., are all UNIX based. Fortunately, there is something called Cygwin, that is an implementation of RedHat Linux that runs under Windows. In a nutshell, Cygwin comprises a set of DLL files implementing UNIX system calls (no small feat), and allows UNIX programs to be compiled and run in Windows. An important part of this packages is the X11 server that implements the X11 event mechanism, so that UNIX/X11 graphics programs can also be compiled and run. In versions since around 2003, the Cygwin X11 server can be run with the "-multiwindow" switch, in which case it runs as a background process on the Windows desktop, and allows X11 windows to appear directly on the desktop (before that, X11 created its own window and applications appeared inside the X11 window, not on the desktop).

There are, as one might expect, some complications. The best versions of the open source EDA tools are the ones based on the Tcl/Tk interpreter. The Tcl/Tk "wish" program is available as part of the Cygwin package. But, that version runs Windows API graphics, not X11. So any program that extends this version of Tcl/Tk and then starts producing X11 events is doomed to failure.

Fortunately, it is possible to compile Tcl/Tk under Cygwin with a modicum of porting effort, even though the developers of Tcl/Tk seem not to have thought it fit to provide this capability themselves. As another fortunate happenstance, the default location of Tcl/Tk when compiled from source is different from its location in packaged version, meaning that an X11 version of Tcl/Tk can be compiled without interfering with the original, Windows-based version that comes packaged with Cygwin.

Because software changes all the time, my usual declaration is that everyone should compile from source. In the case of this hodgepodge of Tcl/Tk, X11, and Cygwin, however, compiling from source is a relatively painful experience for the uninitiated (not to mention a bit annoying for the expert, as well), so in this case, I try to provide binaries for download along with specific instructions that, if followed to the letter, should result in a successfully running program. But, as mentioned at the top of the paragraph, software changes all the time, and programs break, and nothing can be guaranteed. So instructions for a full compile from scratch are provided at the end, if it all comes down to that kind of desperation.

Cygwin distribution download and install:

The first thing you will need is the Cygwin distribution, if you do not already have it (you should!). You can determine for yourself how much of this beast you want to download and install, based on disk space and bandwidth limitations. However, if you have the disk space, and you have the bandwidth, and about an hour to spare while you go have lunch, then you might as well do the full install.

  1. Go to the Cygwin website at sources.redhat.com/cygwin. Click on one of the numerous "Install Cygwin now!" buttons.
  2. The way I do it is to get the "setup.exe" file and save it to local disk, where I can launch it anytime I need to add a missing component to the system.
  3. Launch "setup.exe" (if the install process is not already being run).
  4. Eventually the install wizard gets to the page of choices about which packages to install. I usually select the essential, basic options plus some listed below (for compiling). If you are just going to download and install the pre-compiled binaries, you should not need anything more than the default setup.

    To run X11, make sure you have the following package (click on "X11" to open the list of X11 packages. Once upon a time this was not enabled by default but is, now. If not, click on "skip" next to "xorg-X11-base" to add it to the list of packages to install):

    • X11 base at X11/xorg-X11-base.

    If there is no X11 base package, choose "xinit" and the rest of the necessary dependent packages should be installed automatically.

  5. Select the OpenGL libraries, which are not automatic dependencies of "xinit". These packages are:
    • libGL1 at X11
    • libGLU1 at X11
  6. If you just want to install the precompiled versions of various tools found on this website, then the above should be sufficient, along with the standard Cygwin installation. If you want to compile and install the EDA tools from source, you will need the following packages:
    • autoconf at Devel/autoconf
    • gcc at Devel/gcc
    • libtool at Devel/libtool
    • make at Devel/make
    • M4 at Interpreters/m4
    • X11 development at X11/xorg-x11-devel
    • tcsh at Shells/tcsh (necessary only for compiling magic)
    The following packages are optional but will make life easier if anything goes wrong:
    • gdb at Devel/gdb
    • emacs at Editors/emacs or
    • vim at Editors/vim
    The following packages are not needed by the EDA tools but are a good idea to include anyway:
    • zip at Archive/zip
    • unzip at Archive/unzip
    • automake at Devel/automake
    • g++ at Devel/g++
    Fortunately, once Cygwin is installed, missing pieces can be installed by the same process without having to reinstall everything.

    Continue through the Cygwin install process. Normally, I choose the default destination, which is "C:\cywgin". This location will be the assumption for the remainder of these instructions.

  7. Recent versions of Cygwin that I have seen (2007) put the X11 server icon on the desktop, so all you have to do is to launch it. If it is not there, then you can run it by launching a Cygwin terminal from the windows desktop. At the terminal prompt, type "XWin -multiwindow" to get the X11 server running in the background on the windows desktop. With this method (i.e., running from a terminal) all sorts of debugging information gets printed to this window, so it's best to pop it down. The "X" logo should appear on the Windows taskbar.

  8. To test the ability to run X11 applications, bring up another Cygwin terminal from the windows desktop. At the prompt, type "export DISPLAY=:0" followed by "oclock". The X11 analog clock should appear on the Windows desktop. If you get this far, you're ready to proceed with downloading and installing any of the EDA tools listed below.

Tcl-Cygwin binary distribution download and install:

Download:
File Revision Size Date
tcltk_x11_win.tgz 8.4.11 (2.87MB) October 18, 2005
tcltk_x11_vista.tgz 8.5.0 (2.87MB) January 22, 2008
tcltk_x11_w7.tgz 8.5.11 (9.65MB) October 1, 2012
Install:
  1. Save the above file in the Cygwin root directory, which is normally "C:\cygwin" if the default setup was chosen for the Cygwin installation.
  2. Bring up a Cygwin terminal on the Windows desktop
  3. Do "cd /". The file tcltk_x11_win.tgz should be here.
  4. Do "tar xfz tcltk_x11_win.tgz"
  5. Use the file "tcltk_x11_vista.tgz" for Windows Vista. Other than the name, everything else works as advertised here. This also works for Windows-7. The version of Tcl/Tk is 8.5.0.
  6. Use the file "tcltk_x11_w7.tgz" for Windows-7. Other than the name, everything else works as advertised here. The version of Tcl/Tk is 8.5.11.
Test:
If the X server is on the desktop, then launch it. If not, then bring up one Cygwin terminal and do:
  1. XWin -multiwindow
Either method will run the X server in the background (which should show up as the X11 "X" icon on the Windows taskbar). Diagnostic output ends up going to the terminal if you run it from the terminal command line.

Now, bring up a new Cygwin terminal and do:

  1. export PATH=$PATH:/usr/local/lib
  2. export DISPLAY=":0"
  3. wish
Hopefully this should result in a "%" prompt in the Cygwin terminal and a new window called "wish" on the Windows desktop. Note that if you do not do the "export PATH" line, you will likely get the Windows API graphics-based version of "wish", which is not the right one, and will not work with the EDA tools!
Installing EDA tools:
Tcl/Tk forms the backbone for all of the Tcl/Tk-based EDA tools. Once it has been properly installed, each of the EDA tools can be downloaded as a similar .tgz file and installed in exactly the same way. See the individual pages for instructions specific to each tool:
  1. Magic
  2. XCircuit
  3. IRSIM
  4. Netgen
  5. PCB

Tcl-Cygwin source distribution download, compile and install:

This is not the recommended procedure, as the compile process is annoyingly difficult. For completeness, I am providing the set of instructions detailing the steps I took to get the source for X11-based Tcl/Tk to compile under Cygwin. Follow this link.

email:

Last updated: October 1, 2012 at 5:56pm