andreas-kupries / critcl

Critcl lets you easily embed C code in Tcl. Online documentation at

Home Page:http://andreas-kupries.github.io/critcl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

md5 explicitly sourced, leading to problems on default install

colinmacc opened this issue · comments

Critcl assumes it will find md5/ in its parent directory, which is apparently an unwarranted assumption.

I think, at least, it should depend upon the [package] facility to locate the md5 package, or at most build.tcl should ensure a copy of md5/ is present where critcl later tries to source it. I think the former solution is better, as I'm not sure [info library] is always the place to find md5/

Colin

ERROR:

$ critcl
couldn't read file "/usr/lib/tcl8.6/critcl3.1.15/../md5/md5.tcl": no such file or directory
while executing
"source [file join [file dirname [info script]] ../md5/md5.tcl]"
(file "/usr/lib/tcl8.6/critcl3.1.15/critcl.tcl" line 56)
invoked from within
"source /usr/lib/tcl8.6/critcl3.1.15/critcl.tcl"
("package ifneeded critcl 3.1.15" script)
invoked from within
"package require critcl"
(file "/usr/lib/tcl8.6/critcl-app3.1.15/critcl.tcl" line 22)
invoked from within
"source /usr/lib/tcl8.6/critcl-app3.1.15/critcl.tcl"
("package ifneeded critcl::app 3.1.15" script)
invoked from within
"package require critcl::app"
(file "/usr/bin/critcl" line 4)

INSTALL:
$ sudo tclsh ./build.tcl install
Installing into:
Packages: /usr/lib/tcl8.6
Application: /usr/bin

Installed package: /usr/lib/tcl8.6/critcl3.1.15
Installed package: /usr/lib/tcl8.6/critcl-util1.1
Installed package: /usr/lib/tcl8.6/critcl-class1.0.6
Installed package: /usr/lib/tcl8.6/critcl-iassoc1.0.2
Installed package: /usr/lib/tcl8.6/critcl-literals1.1
Installed package: /usr/lib/tcl8.6/critcl-enum1.0.1
Installed package: /usr/lib/tcl8.6/critcl-bitmap1.0.1
Installed package: /usr/lib/tcl8.6/critcl-emap1
Installed package: /usr/lib/tcl8.6/critcl-app3.1.15
Installed package: /usr/lib/tcl8.6/util84
Installed package: /usr/lib/tcl8.6/stubs
Installed package: /usr/lib/tcl8.6/critcl-platform
Installed application: /usr/bin/critcl

critcl is a bit recursive regarding the handling of md5 and wheere it looks for it.

Mainly because there is a critcl-based implementation of md5 around and it would like to use that.
This is complicated by the critcl modes. Only mode "compile&run" needs md5 to keep the object files for different packages separate in its cache. This also is where the recursion can hit, trying to build the fast md5 and needing md5 for the same, somehow having to fall back to the slow form, and replacing it at the end with the fast one.

Marked as bug. Needs fixing even if I currently do not know how.

Completely reworked.

  • Critcl now uses its own md5 package, and only that.
  • No dependencies on Tcllib, TcllibC, or other.
  • Installation is handled by
    • installing the pure-Tcl core packages and critcl app first,
    • and then using that in package mode (-pkg) to built md5.
      Note that package mode does not make use of md5, IOW there is chicken/egg trouble.

I believe that at least some of the original code complexity in this area came from package mode originally kept dependent on md5 and needed to built md5. With the change to a plain sequential counter in package mode this cycle was broken, allowing the simplification.