dbohdan 2016-12-04: This is a step-by-step guide on how to build native Tcl/Tk binaries for Windows on Windows. I found it the most convenient to do with MSYS2. The result of following this guide will be a complete Tcl/Tk installation that is portable from one Windows machine to another. The instructions have been tested with Tcl 8.6.6.
1. Install MSYS2 by following the instructions on its webpage. Prefer the 64-bit version if you have 64-bit Windows. You will be able to build 32-bit and 64-bit binaries from the 64-bit version.
2. Start "MSYS2 MingGW 32-bit" from the "MSYS2 64bit" folder in the Start menu.
3. Install the build dependencies by running the following command in the shell:
pacman -Syuu make mingw-w64-i686-gcc tar wget
4. Download and extract the latest source code release of Tcl. The GitHub mirror is convenient for this because it does not require authentication. Build and install Tcl.
cd ~ wget -O tcl-release.tar.gz https://github.com/tcltk/tcl/archive/release.tar.gz tar xvf tcl-release.tar.gz cd tcl-release/win/ ./configure --enable-threads --prefix=/c/tcltk/ make make install
5. (Optional) Build and install Tk.
$ cd ~ $ wget -O tk-release.tar.gz https://github.com/tcltk/tk/archive/release.tar.gz $ tar xvf tk-release.tar.gz $ cd tk-release/win/ $ ./configure --prefix=/c/tcltk/ --with-tcl=../../tcl-release/win/ $ make $ make install
6. (Optional) Install Tcllib.
cd ~ wget -O tcllib-release.tar.gz https://github.com/tcltk/tcllib/archive/release.tar.gz tar xvf tcllib-release.tar.gz cd tcllib-release/ ./configure --prefix=/c/tcltk/ make install
You will find your Tcl/Tk installation in C:\tcltk\.
To build a 64-bit version run "MSYS2 MingGW 64-bit" instead of "MSYS2 MingGW 32-bit" in step 2, install mingw-w64-x86_64-gcc instead of mingw-w64-i686-gcc in step 3 and configure Tcl and Tk with the option --enable-64bit in steps 4-5.
bll 2017-10-24 To get a 32-bit version of Tcl/Tk that would work without installing Msys2 on the target machine, I had to edit the Makefile after the configuration step:
# [ ] contains a space and a tab. sed -i -e '/^LIBS[ ]*=/ s, -lmsvcr100,,' -e '/^LIBS[ ]*=/ s,$, -lmsvcr100,' Makefile
Without msvcr100, the Tk code complains about a missing _time32 value upon execution (tkCanvPs.c has some time calls).
msvcr100.dll needs to be available on the target machine. This is available from MicroSoft: