From: Schelte B. <tc...@tc...> - 2024-09-20 11:28:19
|
All, As I was interested in the new "Task Executables" functionality provided by TIP 430 (basically an alternative for starpacks), I did some experiments and got unexpected results. I used this main.tcl: puts "Script: [info script]" puts "Library: $tcl_library" puts "Mounted: [dict keys [zipfs mount]]" After compiling tclsh, I performed the following commands: cp tclsh demo zip demo.zip main.tcl cat demo.zip >> demo ./demo First of all, I found a difference between building with and without --disable-shared. Shared: Script: //zipfs:/app/main.tcl Library: //zipfs:/lib/tcl/tcl_library Mounts: //zipfs:/lib/tcl //zipfs:/app Static: Script: //zipfs:/app/main.tcl Library: /home/sbron/tcl/tcl/library Mounts: //zipfs:/app I was surprised to find that with the static build, tcl_library points to the library in the source tree. So then I tried moving the demo binary to another location. That resulted in: application-specific initialization failed: Cannot find a usable init.tcl in the following directories: {} /home/sbron/usr/lib/tcl9.0 /lib/tcl9.0 /lib/tcl9.0 /library /library /tcl9.0/library /tcl9.0b4/library /tcl9.0b4/library This probably means that Tcl wasn't installed properly. Script: //zipfs:/app/main.tcl Library: /tcl9.0b4/library Mounts: //zipfs:/app Running the static tclsh interactively, I get a different result: % source main.tcl Script: main.tcl Library: //zipfs:/app/tcl_library Mounts: //zipfs:/app I can move the tclsh binary to another location without any issues. As a final attempt, I moved main.tcl into a directory demo.vfs and then ran the following command from the tclsh: % zipfs mkimg demo ./demo.vfs ./tclsh ./demo.vfs/main.tcl This produced a binary that was smaller than the tclsh binary. Running it just gave me a command prompt. Manually sourcing the script then produced the following: % source demo.vfs/main.tcl Script: demo.vfs/main.tcl Library: /home/sbron/tcl/tcl/library Mounts: Is there something I'm doing wrong? Or is the TIP 430 implementation incomplete? Schelte. |