Version 13 of Building Tcl/Tk with Mingw

Updated 2007-10-11 11:40:15 by suchenwi

Mo Dejong 10-12-2005

This page describes how to build Tcl/Tk under Windows using the Msys and Mingw packages. Mingw is a gcc port for Windows that can be used to build native Win32 applications and dlls. Msys is a bash shell ported to Windows that is used to run Tcl's configure script. This page does not describe how to build Tcl/Tk with VC++, although that build environment is also supported. It may possible to build Tcl/Tk with other compilers like the Borland or Cygwin, but these tools are not well supported and will require some effort to get everything working.

Building Tcl/Tk 8.4.16, the current stable release.

First (Downloads):

  1. Go to http://sourceforge.net/project/showfiles.php?group_id=10894
  2. Download msys_mingw8.zip (or newer version)
  3. Download tcl8416-src.zip
  4. Download tk8416-src.zip

Second (Unzip):

  1. Unzip msys_mingw8.zip to whereever you want to keep it (I put mine on the root of the C drive.) It will create a top level directory called msys and a directory tree underneath containing all necessary files for msys/mingw operation. Now start msys by double clicking on msys.bat (in C:\msys) or msys95 for Win95. The following commands are typed into the msys shell.
  2. Create a src directory somewhere convenient. I used "mkdir /src" (C:\msys\src if looking at it from outside msys.)
  3. Unzip tcl8416-src.zip into the src directory
  4. Unzip tk8416-src.zip into the src directory

Third (Build Tcl):

  1. mkdir /build
  2. mkdir /build/tcl
  3. cd /build/tcl
  4. /src/tcl8.4.16/win/configure --prefix=/opt/tcl
  5. make
  6. make install

Fourth (Build Tk):

  1. mkdir /build/tk
  2. cd /build/tk
  3. /src/tk8.4.16/win/configure --prefix=/opt/tcl --with-tcl=/build/tcl
  4. make
  5. make install

NOTE: At this point Everything is installed and should be working. You could delete /build and /src if you wanted to. You will find it all in /opt/tcl (C:\msys\opt\tcl). Run Tcl from the msys shell by starting the tclsh84 shell found in /opt/tcl/bin. Run Tk from the msys shell by starting the wish84 shell found in /opt/tcl/bin.

See also


Note: ensure that your msys.bat file contains a set PATH= at the top or you will get coredumps.

RS 2007-10-11: This advice leads, on my W95 box, to msys dying very soon after startup. Trying to find another way...

DKF: I never needed to do that, but then I use XP. (It's much more important to make sure that you install things in a directory without spaces in the name; a lot of the build process is very fragile if you don't follow that...)

RS same day: Building 8.5b1 on W95 SE almost worked... just in make install I got

 Installing time zone data
 /bin/sh: ./tclsh85.exe: Permission denied
 make: *** [install-tzdata] Error 126

and a pop-up which roughly translated says

 missing Export-USER32.DLL:MsgWaitForMultipleObjectsEx

So it's true when they say W95 is no longer supported... :( The sore spot is

 $ grep -n MultipleObjectsEx *.c
 tclWinNotify.c:475:     result = MsgWaitForMultipleObjectsEx(1, &tsdPtr->event,
        timeout,

GPS suggested to try it without the "Ex" - this lets make install come through. make test still running (hey, this old box has only 200MHz...) In fact, it seems to hang after

 ---- Result was:
 timeout {} foobarbaz timeout
 ---- Result should have been (exact matching):
 {} timeout foobarbaz timeout
 ==== io-6.56 FAILED

Category Windows