Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-02
15:40 • Ticket [bf2652aedf] Tcl 9.1b1 with zipfs support: incorrect value for tcl_librar... artifact: 9c950ed371 user: anonymous
14:29 • Ticket [bf2652aedf]: 3 changes artifact: 598c600d42 user: jan.nijtmans
14:10 • Ticket [bf2652aedf]: 3 changes artifact: e58771955f user: anonymous
2026-09-29
21:57 • Ticket [bf2652aedf]: 4 changes artifact: 555465e140 user: jan.nijtmans
14:21 • New ticket [bf2652aedf]. artifact: 67cc80b2c7 user: anonymous

Tcl 9.1b1 with zipfs support: incorrect value for tcl_library variable

Openbf2652aedf42e59076d8f29da8d87b48d83948bbCreated 64 days agoUpdated 61 days ago
Descriptionplain2026-09-29 14:21:26
Today, I compiled the Unix version of Tcl/Tk 9.1b1 with zipfs support (the default). When I tried an old script, it failed on this line:

source [info library]/init.tcl

After some digging, I found that 'info library' was returning an incorrect value. Compare Tcl 9.0 to Tcl 9.1b1, both compiled with zipfs support on the same machine.

% ~/tcltk9.1/bin/wish9.1 
% echo [info library]
/Users/rmtrines/tcltk9.1/lib/tcl9
%
% ~/tcltk9/bin/wish9.0 
% echo [info library]
//zipfs:/lib/tcl/tcl_library
%

The problem with that: when Tcl 9.1 is compiled and installed with zipfs support, the directory tcltk9.1/lib/tcl9 does not contain the file init.tcl, needed by my script.

When I run this sequence of commands in wish9.1:
% set tcl_library //zipfs:/lib/tcl/tcl_library
//zipfs:/lib/tcl/tcl_library
% info library
//zipfs:/lib/tcl/tcl_library
% source [info library]/init.tcl
% 

Hey, it works fine, no errors. So it's purely the value of tcl_library that is causing the problem.
jan.nijtmanswiki2026-09-29 21:57:18

I cannot reproduce this with Tcl/Tk 9.1.0 final:

$ wish9.1
% info library 
//zipfs:/lib/tcl/tcl_library
% set tcl_library
//zipfs:/lib/tcl/tcl_library
% set tk_library
//zipfs:/lib/tk/tk_library

anonymousplain2026-10-02 14:10:19
Let me add more info.

Here is a little C program that creates a Tcl interpreter and tries to run a little script.

#include <stdio.h>
#include <tcl.h>

int main() {

  char TclCommand[2048];
  int retval;

  printf("C start\n");
  Tcl_Interp *interp = Tcl_CreateInterp();
  Tcl_Init(interp);
  sprintf(TclCommand,"source setupscript.tcl\n");
  retval = Tcl_Eval(interp,TclCommand);
  if (retval !=TCL_OK) {
    printf("Error %d: %s\n", retval, 
	   Tcl_GetStringResult(interp));
  }
  Tcl_DeleteInterp(interp);
  printf("C end\n");
  return 0;
}

Here is the little script needed by the program:

puts "Tcl start"
puts -nonewline "Tcl version: "
puts [info tclversion]
puts [info library]
puts "Tcl end"

Here is how I compiled it:

#!/bin/sh

export TCLDIR=${HOME}/tcltk9.1

gcc-16 -o tcl_init_test -I${TCLDIR}/include tcl_init_test.c -L${TCLDIR}/lib -ltcl9.1

This is the output I get for Tcl 9.1:

% ./tcl_init_test
C start
Tcl start
Tcl version: 
9.1
Error 1: no library has been specified for Tcl
C end

To compare: this is the output I get for Tcl 9.0, in the same environment:

% ./tcl_init_test
C start
Tcl start
Tcl version: 9.0
//zipfs:/lib/tcl/tcl_library
Tcl end
C end

Note that both Tcl versions have been configured in the same way:

#!/bin/sh

export CC=gcc-16

./configure --prefix=${HOME}/tcltk9.1

Hope this helps.
jan.nijtmansmarkdown2026-10-02 14:29:21

The release notes for Tcl 9.1 mention:

So, can you add a call to TclZipfs_AppHook(&argc, &argv); before doing the Tcl_CreateInterp() call? This will mount the zipfile packed with the Tcl shared library. That should help to find the init.tcl file.

anonymousplain2026-10-02 15:40:03
OH yes, that does indeed work, both for the little test problem and the actual code I was trying to build/fix.

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