Building Tcl under cygwin with MINGW

page started by TV.

See Also

Building Tcl and Tk with Cygwin
Building Tcl and Tk for Windows with MSYS2
A Windows port of gcc & binutils.
A fork of cygwin.
A Tcl-based configurable framework for automatically building C/C++ based software libraries from source code.


The official Tcl has had the Cygwin build support removed, because it was in need of someone to maintain it, and no one came forward. Users looking for the most simple way to build Tcl/Tk under Windows should take a look at Building Tcl/Tk with Mingw.

Recently trying out the latest CVS version of tcl 8.5, I found the standard distr. doesn't allow a cygwin build. That in itself is not disastrous, but I at least would like to use my installed cygwin env to build. That should be possible with mingw, which however is already present in the cygwin distr., usually.

The main trick was suggested by GPS, to make cygwin not use its normal gcc, but in fact the 9as (what?) I used before: -mno-cygwin option (under bash):

export CC="gcc -mno-cygwin"

A comment on the outcome: I wanted to use the resulting tclsh without installing, which is problematic because it looks for a valid init.tcl . It appears that a make shell or make runtest is possible.

make test

works normally.

Tcl 8.6.4 under Cygwin with a native minGW

PYK 2015-10-05:

Cygwin includes a build of minGW that targets the Cygwin platform, but with the aid of -mno-cygwin will also cross-compile to Windows binaries. It is also possible to use a native Windows minGW build to do the compiling, with Cygwin as the build environment. This produces a "pure" Windows build, with no Cygwin configuration. As of Tcl-8.6.4, some patching is necessary. Here are the steps:

Download and apply this patch
invoke a script like the following, substituting in some valid path to the minGW bin directory:
#! /bin/env bash
cd tcl8.6.4/win
./configure --prefix='/cygdrive/c/some/installation/path' --enable-64bit --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
make install

Packages distributed in the pkgs directory should also build and install succesfully. If adding packages to that directory, have a look at the patches, and then patch the added package accordingly. Better yet, path it and build it separately using the newly-build Tcl.