Tcl Source Code

View Ticket
Login
Ticket UUID: 2ef3430fdc612eb42a7a0aae7b3babed08d92c17
Title: Don't assume that host=*mingw32* means cross-compiling
Type: Bug Created on: 2025-10-26 13:24:59
Submitter: oscarfv Assigned to: jan.nijtmans
Subsystem: 53. Configuration and Build Tools Severity: Important
Priority: 5 Medium Last modified: 2026-10-22 17:19:28
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-20 15:21:42
Version: 8.6.18, 9.0.5, 9.1.0
Description:
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.
User Comments:
jan.nijtmans added on 2025-10-28 10:53:26:

I'm open to a better solution here


anonymous added on 2025-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.)

oscarfv added on 2025-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.storchaka added on 2026-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 [e4fd3a27b4|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.nijtmans added on 2026-10-20 14:23:52:

I like this solution!

+1 to merge