Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-27
13:25
Fix [ac3ea87305] and [17ffc49790]. New option --with-system-zlib and fix out-of-tree build with "con... check-in: 0890c290ed user: jan.nijtmans tags: core-8-6-branch
2026-10-20
21:25 • Ticket [ac3ea87305] Don't assume that Windows has no usable zlib/tommath... artifact: a929ee0ceb user: jan.nijtmans
21:14 • Ticket [ac3ea87305]: 3 changes artifact: bdb859fec2 user: serhiy.storchaka
21:12
Fix [ac3ea87305]: Don't assume that Windows has no usable zlib/tommath check-in: 809ce55fbc user: serhiy.storchaka tags: core-9-0-branch
21:09 • Closed ticket [ac3ea87305]: Don't assume that Windows has no usable zlib/tom... artifact: 13e150bda0 user: serhiy.storchaka
21:09
Fix [ac3ea87305]: Don't assume that Windows has no usable zlib/tommath check-in: be527d2e2d user: serhiy.storchaka tags: trunk, main
20:43 • Ticket [ac3ea87305] Don't assume that Windows has no usable zlib/tommath... artifact: aef14f593f user: jan.nijtmans
19:15 • Ticket [ac3ea87305]: 4 changes artifact: 9b9c5b73ce user: serhiy.storchaka
19:12
Fix [ac3ea87305]: win/configure gets --with-system-zlib and --with-system-libtommath to link the zli... closed check-in: 61fe2461e3 user: serhiy.storchaka tags: win-system-zlib-tommath
2025-10-30
09:20 • Ticket [ac3ea87305] Don't assume that Windows has no usable zlib/tommath... artifact: cf886eb922 user: jan.nijtmans
08:45 • Ticket [ac3ea87305]: 3 changes artifact: bf55603793 user: oscarfv
08:44 • Ticket [ac3ea87305]: 3 changes artifact: 5f5466e9ec user: oscarfv
2025-10-29
21:50 • Ticket [ac3ea87305]: 4 changes artifact: 749029ad89 user: jan.nijtmans
09:11 • Ticket [ac3ea87305]: 3 changes artifact: e52acd02b8 user: oscarfv
2025-10-26
12:43 • Ticket [ac3ea87305]: 3 changes artifact: 5f0fc1488a user: oscarfv
12:43 • New ticket [ac3ea87305]. artifact: 91f3771a0c user: oscarfv

Don't assume that Windows has no usable zlib/tommath

Closed / Fixedac3ea8730530daf7c680a4b9e2163dc146091fd6Created 1 year agoUpdated 43 days ago
Descriptionplain2025-10-26 12:43:34
win/configure has this comment:

#------------------------------------------------------------------------
#	Add stuff for zlib/libtommath; note that this is mostly done in the
#	makefile now as we just assume that the platform hasn't got usable
#   z.lib/tommath.lib
#------------------------------------------------------------------------

MSYS2/Mingw-Packages has usable zlib & tommath for many years now. I'm the occasional package maintainer for tcl/tk and having to refresh the patch that corrects this assumption on every minor release is a pain. I'm looking into packaging tcl9/tk9 and having this annoyance resolved will be great.

I'm not proficient at autotools/automake, otherwise I would be glad to submit a patch years ago.

Thanks.
Referenced by4
  • 0890c290edFix [ac3ea87305] and [17ffc49790]. New option --with-system-zlib and fix out-of-tree build with "configure --srcdir=..." check-in2026-10-27 13:25:50
  • 809ce55fbcFix [ac3ea87305]: Don't assume that Windows has no usable zlib/tommath check-in2026-10-20 21:12:44
  • be527d2e2dFix [ac3ea87305]: Don't assume that Windows has no usable zlib/tommath check-in2026-10-20 21:09:32
  • 61fe2461e3Fix [ac3ea87305]: win/configure gets --with-system-zlib and --with-system-libtommath to link the zlib and libtommath of the build system (e.g. MSYS2) instead of the bundled ones. check-in2026-10-20 19:12:44
oscarfv Ticket [ac3ea87305]: 3 changes [History diff]2025-10-26 12:43:58
oscarfvplain2025-10-29 09:11:09
One brute-force solution for this is to explicitly exclude Tcl's zlib1.dll, etc. from our Tcl package. As long as Tcl's vendored zlib & tommath are keep in-sync with upstream (so it is basically building the same version as we have in MSYS2), it shouldn't be problematic, although not as robust as a proper build toggle.

What do you think?
jan.nijtmanswiki2025-10-29 21:50:31

> What do you think?

That should be OK. The zlib/tommath dll's distributed with Tcl are built with clang (ucrt) and with -static-gcclib. No other deviations from the standard build. It should be drop-in compatible with the MSYS2 built dll's.

oscarfvplain2025-10-30 08:44:30
Thanks. I already adapted our (MSYS2) build recipe to use this approach instead of the patch for zlib in 8.6.17 and will do the same for tommath in 9.0.3.

About 9.0.x: right now fails while building tcl90.dll with unresolved references to Tcl_GetNumberFromObj, Tcl_InitStringRep, TclBN_mp_neg, ....  ClockMCDict and more. Do you want a ticket for this or is it a known problem?
oscarfvplain2025-10-30 08:45:10
9.0.x is 9.0.2 on my previous comment.
jan.nijtmanswiki2025-10-30 09:20:36

> About 9.0.x: right now fails while building tcl90.dll with unresolved references ...

Try passing CFLAGS_OPTIMIZE in stead of CFLAGS.

See: [84e8a94613] (not exactly the same, but similar)

It might also be that a tcl.h from 8.6 is still found somewhere

serhiy.storchakawiki2026-10-20 19:15:30

Proposed in branch [win-system-zlib-tommath]: win/configure gets two options, off by default, so the standard build is unchanged:

--with-system-zlib        link -lz instead of the bundled zlib
--with-system-libtommath  link -ltommath instead of the bundled libtommath

With them the bundled zlib1.dll / libtommath.dll and their import libraries are neither copied nor installed (for static builds the bundled objects are not compiled in), and configure fails if the library is not found. Tested natively with MSYS2 UCRT64 and its zlib and libtommath packages: tcl91.dll imports zlib1.dll and libtommath-1.dll from /ucrt64/bin, and the zlib, expr and format tests pass. Also checked with a MinGW-w64 cross build on Linux (shared and static, tests under Wine). The bundled zlib.h and tommath.h are still used for compiling, as on Unix.

jan.nijtmanswiki2026-10-20 20:43:23

I don't see anything wrong with this, so go ahead.

+1

serhiy.storchaka Closed ticket [ac3ea87305]. [History diff]2026-10-20 21:09:33
serhiy.storchakawiki2026-10-20 21:14:09

Merged to [trunk] and [core-9-0-branch].

jan.nijtmanswiki2026-10-20 21:25:31

Please don't forget the changes.md/changes entries

Log in (anonymous is fine) to add a comment.