TEA (tclconfig) Source Code

View Ticket
Login
2022-08-22
10:31 New ticket [c03b9df15f] platform check is hardcoded to use TCL_CC. artifact: c65aa0a03e user: chrstphrchvz

Ticket UUID: c03b9df15fe80558fd96348b89d95921f8655f27
Title: platform check is hardcoded to use TCL_CC
Type: Bug Version:
Submitter: chrstphrchvz Created on: 2022-08-22 10:31:53
Subsystem: 85. tclconfig Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2022-08-22 10:31:53
Resolution: None Closed By: nobody
    Closed on:
Description:

The checking platform step is hardcoded to use TCL_CC (originally since [30736d63f0]). This can unexpectedly cause TEA_PLATFORM to be set to windows rather than unix if TCL_CC is not set to a working compiler (e.g. the path TCL_CC is set to is not present on the system, or TCL_CC is not set at all).

I was led to this by someone’s report for an issue building tkimg for macOS (https://sourceforge.net/p/tcl/mailman/tcl-mac/thread/8A4FE6C3-3628-4848-AD15-8C3BAF5F8CFB%40gmx.net/#msg37692853), whose config.log contains:

configure:3395: checking platform
configure:3413: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -arch x86_64 -arch arm64  conftest.c >&5
./configure: line 1503: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang: No such file or directory
…
configure:3424: checking for cygpath
configure:3452: result: echo
configure:3464: result: windows

I have not yet confirmed, but I suspect tclConfig.sh is setting TCL_CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang even though it is not currently on the system (not every macOS user has Xcode installed, or installed at that exact location; the system could instead be relying on Xcode command line tools alone or e.g. /Applications/Xcode-beta.app).

I don’t have a proposed fix for this, but I’m inclined to believe use of TCL_CC is not strictly necessary (as it is not used elsewhere in tcl.m4); and as already discussed elsewhere (e.g. https://wiki.tcl-lang.org/page/tclConfig.sh), certain values from tclConfig.sh are often useless, particularly when Tcl is built on one system and then installed on another system that doesn’t have the exact same compiler toolchain present. A possible workaround is to override TCL_CC when configuring extensions, i.e. TCL_CC=/usr/bin/clang ./configure …