Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Don't assume that host=*mingw32* means cross-compiling

Closed / Fixed2ef3430fdc612eb42a7a0aae7b3babed08d92c17Created 1 year agoUpdated 41 days ago
Descriptionplain2025-10-26 13:24:59
win/configure has this:

# Cross-compiling
case ${host_alias} in
*mingw32*)
    TCL_EXE="tclsh"
    ;;
*)
    TCL_EXE="TCL_LIBRARY=\"\${LIBRARY_DIR}\"; export TCL_LIBRARY; ./\${TCLSH}"
    ;;
esac


The problem is that it assumes the existence of tclsh. When building under MSYS2 or Cygwin, that is not necessarily true, neither the pre-existing tclsh is required.

The current behavior makes the build to fail under MSYS2/Cygwin unless the user has tclsh already installed.

We either need a more robust mechanism for detecting a "true" cross-compilation and/or just test for the presence of tclsh at configure time.
Referenced by4
  • 161779a5c4Fix [59a9b957c6] and [2ef3430fdc]: Windows "make distclean" removes tcl.pc; win/configure uses an installed tclsh only when cross-compiling, not for any *mingw32* host. check-in2026-10-20 15:33:16
  • 063874bae3Fix [59a9b957c6] and [2ef3430fdc]: Windows "make distclean" removes tcl.pc; win/configure uses an installed tclsh only when cross-compiling, not for any *mingw32* host. check-in2026-10-20 15:33:15
  • c87b92e2eeFix [59a9b957c6] and [2ef3430fdc]: Windows "make distclean" doesn't clean up tcl.pc; don't assume that host=*mingw32* means cross-compiling check-in2026-10-20 15:21:42
  • e4fd3a27b4Fix [2ef3430fdc]: win/configure decides whether to use an installed tclsh from $cross_compiling, not from host=*mingw32*, so native MSYS2/Cygwin builds use the built tclsh. check-in2026-10-20 13:25:16
jan.nijtmanswiki2025-10-28 10:53:26

I'm open to a better solution here

anonymousplain2025-10-28 12:32:09
What about using tclsh if it is available and the generated tclsh if it is not?

AC_CHECK_PROG(TCL_EXE, tclsh, tclsh, "TCL_LIBRARY=\"\${LIBRARY_DIR}\"; export TCL_LIBRARY; ./\${TCLSH}")

... or always use the generated tclsh when we know that we can execute it (i.e. we are running on Windows):

AC_CANONICAL_HOST

case "${host_os}" in
    cygwin*|mingw*)
        TCL_EXE="TCL_LIBRARY=\"\${LIBRARY_DIR}\"; export TCL_LIBRARY; ./\${TCLSH}"
        ;;
    *)
        TCL_EXE="tclsh"
        ;;
esac

You can argue that the build will fail if it is a true cross-compilation and tclsh is absent, but that problem already exists with the current implementation.

For improving that, the configure script could put a check for the existence of tclsh on the *) case above and throw an error when absent.


(As I already mentioned, I don't really know about autotools, the above is the result of a quick web search.)
oscarfvplain2025-10-28 15:20:55
Just in case you go with the second option and for the sake of completeness, let's cover MSYS* as well:

AC_CANONICAL_HOST

case "${host_os}" in
    cygwin*|msys*|mingw*)
        TCL_EXE="TCL_LIBRARY=\"\${LIBRARY_DIR}\"; export TCL_LIBRARY; ./\${TCLSH}"
        ;;
    *)
        TCL_EXE="tclsh"
        ;;
esac
serhiy.storchakawiki2026-10-20 13:27:21

Confirmed with a native MSYS2 UCRT64 build: with no tclsh on PATH, make install fails at install-tzdata with "tclsh: command not found".

win/configure.ac treated any *mingw32* host as a cross build. Proposed fix in branch [win-native-mingw-tclsh]: use autoconf's $cross_compiling instead, which is what the anonymous comment asked for. Tested natively in MSYS2 (configure says "cross compiling... no", install works) and with a Linux MinGW cross build (still TCL_EXE = tclsh).

jan.nijtmanswiki2026-10-20 14:23:52

I like this solution!

+1 to merge

serhiy.storchaka Closed ticket [2ef3430fdc]. [History diff]2026-10-20 15:21:42
serhiy.storchaka Ticket [2ef3430fdc]: 3 changes [History diff]2026-10-22 17:19:28
Log in (anonymous is fine) to add a comment.