Tcl Source Code

View Ticket
Login
Ticket UUID: 9cdb0d585883311b2acc9577820e90713968c1cb
Title: unix/Makefile.in problem when building pkgs for static builds
Type: Bug Created on: 2020-11-02 21:37:38
Submitter: anonymous Assigned to: jan.nijtmans
Subsystem: 53. Configuration and Build Tools Severity: Important
Priority: 5 Medium Last modified: 2026-10-30 21:11:33
Status: Closed Closed by: jan.nijtmans
Resolution: Wont Fix Closed on: 2026-10-30 21:11:33
Version: 9.1.0
Description:
In unix/Makefile.in, the lines
                      $(PKG_CFG_ARGS) --libdir=$(PACKAGE_DIR) \
                      --enable-shared --enable-threads; ) || exit $$?; \
want to be
                      --libdir=$(PACKAGE_DIR) \
                      --enable-shared --enable-threads $(PKG_CFG_ARGS) ; ) || exit $$?; \

so that the PKG_CFG_ARGS are not overridden by --enable-shared, and --disable-shared can take effect for static builds.
User Comments:
serhiy.storchaka added on 2026-10-20 12:29:51:

Still present in 8.6, 9.0 and 9.1, on Unix and Windows: the fixed --enable-shared comes after the arguments passed on to the packages' configure, so --disable-shared never reaches them. This may be intended: shared, stub-enabled packages can be loaded with [package require] also from a static Tcl, while static ones only help when linked into the application. So there are two proposed fixes, please choose:

  • pkgs-respect-disable-shared, as suggested here: --disable-shared builds static packages too (--libdir stays last). Incompatible for static Tcl builds that load the bundled packages.
  • pkgs-shared-make-var: packages stay shared by default, and make PKG_SHARED=--disable-shared builds them static. No change for existing builds.

Both tested with Thread in pkgs/, on Linux and with a MinGW cross build.


dgp added on 2026-10-21 18:05:34:
The purpose of the `make *packages` targets in Tcl's unix Makefile
is to make installable builds of the bundled collection of packages
that can then successfully be [package require]d or [load]ed into
the Tcl built by the same Makefile.  Forcing the --enable-shared
build is intentional to achieve this aim.

Back when it made a difference, forcing --enable-threads had similar
justification.  I believe in Tcl 9 we can drop that since we
require thread-enabled code for everything now.

The Tcl+pkgs source code distribution contains the full source code
releases of all the packages.  Anyone who needs a --disable-shared
build of one of those packages is welcome to do that by directly
working within the package's source directory and using its own
configuration and build mechanism.  I strongly prefer we do not enable
that control in Tcl's unix/Makefile.  If you choose to build one of the
bundled packages through the Tcl+pkgs collection, then you get the build
configuration suitable for Tcl+pkgs installation.

jan.nijtmans added on 2026-10-30 21:11:33:

I agree with Don. If you build a package with --disable-shared, the only thing built is a static library (*.a or *.lib). This library is not useful in itself, it still has to be linked in the application, neither Tcl nor Tk have the machinery to do that. So, when being part of the Tcl 'batteries included', --disable-shared makes no sense for the included packages.

So, closing as 'Won't fix' (in fact 'works as designed') makes most sense.

Anyway, thanks for bringing this up! Closing the two branches. Sorry!