View Ticket
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to
or submit via the online form by Aug 20.
Ticket UUID: 06f1692bbe29449ac3f2161ebf9dd153d0349845
Title: cross compilation with native mingw compiler in Cygwin environment
Type: Patch Version:
Submitter: pooryorick Created on: 2015-10-05 05:40:38
Subsystem: 85. tclconfig Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-10-07 13:19:29
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2015-10-07 13:19:29

With a few changes, tcl.m4 can cover the scenario of using a native minGW compiler from a cygwin shell/utilities environment. Since Cygwin is a target platform in its own right, this is a form of cross-compilation. The included patch seems to be sufficient to enable this mode of building Tcl. See Tcl issue d995ca52091dd8db7db415e4256e903093ee043a for a companion patch.

User Comments: jan.nijtmans added on 2015-10-07 13:19:29:

Applied (with some tweaking) to core-8-5-branch and trunk.

jan.nijtmans added on 2015-10-05 07:38:14:
Thanks! Actually, I have the building environment working to cross-compile with mingw under cygwin, but I tweaked the environment a little bit to accomplish this. Your patch looks like a better solution.

pooryorick added on 2015-10-05 05:44:14:

Index: tcl.m4
--- tcl.m4
+++ tcl.m4
@@ -2879,18 +2879,26 @@
     case "`uname -s`" in
-	    AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
+	    AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
-	    CYGPATH=echo
+	    # Maybe we are cross-compiling
 	    # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
+	    case ${host_alias} in
+		*mingw32*)
+		    AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
+		;;
+		*)
+		    CYGPATH=echo
+		;;
+	    esac
 	    # Maybe we are cross-compiling....
 	    case ${host_alias} in
@@ -4095,15 +4103,15 @@
 	eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}${DBGX}"
 	eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
 	eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
-    $1_BUILD_LIB_SPEC="-L`pwd` ${$1_LIB_FLAG}"
+    $1_BUILD_LIB_SPEC="-L`$CYGPATH $(pwd)` ${$1_LIB_FLAG}"
     $1_LIB_SPEC="-L${pkglibdir} ${$1_LIB_FLAG}"
-    $1_BUILD_STUB_LIB_SPEC="-L`pwd` [$]{$1_STUB_LIB_FLAG}"
+    $1_BUILD_STUB_LIB_SPEC="-L`$CYGPATH $(pwd)` [$]{$1_STUB_LIB_FLAG}"
     $1_STUB_LIB_SPEC="-L${pkglibdir} [$]{$1_STUB_LIB_FLAG}"