Tk Source Code

View Ticket
Login
Ticket UUID: 22d2341c9d48aa2eac08227bae0e647c7f5909bb
Title: Building extensions for Tk 8 and Tcl 8 in a Tcl 9 environment
Type: Bug Version: 9.0
Submitter: jan.nijtmans Created on: 2024-11-12 15:37:03
Subsystem: (unused) Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-10-04 17:01:48
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2026-10-04 17:01:48
Description:
TIP #628 didn't take into account that some extensions link with both Tcl and Tk. There is no --with-tk8 option, corresponding with the --with-tcl8 option for Tcl.

Maybe there are more problems than that. @max, if you have more information, you can add that to this ticket.
User Comments: jan.nijtmans added on 2026-10-04 17:01:48:

Hm, I was a little bit too quick. Something which is supported with Tk 9.0 is used its headers to compile actually with Tcl 8.6/Tk 8.6. In this situation, the tk8-mode-tcl-size makes sense.

Thanks!


jan.nijtmans added on 2026-10-04 16:58:55:

For Tk, "building with Tcl 8" actually meant "building with Tcl 8.7". Reason: Tk 9.0 uses Tcl_GetIntForIndex(), Tcl_CreateObjCommand2(), Tcl_DStringToObj() and Tcl_UtfToChar16DString(). Tk 9.0 was never meant to work with Tcl 8.6.

Also, Tk 9.0 can only be compiled with TCL_UTF_MAX=4, in order to be able to use unicode codepoints > 0xFFFF. Tcl 8.6 doesn't support that at all. Tcl 8.7 does, but will never be released (now that Tcl 9.0 is taking over rapidly).

Therefore, branch tk8-mode-tcl-size doesn't make much sense. Even with this change, it's far from being able to actually run with Tcl 8.6.


serhiy.storchaka added on 2026-10-04 10:52:45:

Since the fix for Tcl ad08bca6b1 (Tcl 9.0.4), tk.h of Tk 9.0 no longer compiles in Tcl 8 mode: tcl.h undefines Tcl_Size at its end, but tk.h and tkDecls.h use it. Proposed fix in branch tk8-mode-tcl-size: tk.h defines and undefines Tcl_Size as tclOODecls.h does. With it, the structures have the same sizes as in Tk 8.6. Tk 9.1 headers do not support Tcl 8 mode, so this is only for 9.0.


jan.nijtmans added on 2024-11-13 20:23:29:

I succeeded to build the Tkimg extension for Tcl 8.x/Tk 8.x, but using Tcl 9.0/Tk 9.0 headers. What I needed was this change in TEA, a new --with-tk8 option. And a few modifications in Tkimg.

Any more missing?