Tcl Library Source Code

Ticket Change Details
Login
Overview

Artifact ID: 69645564c81834da1b52c90bb3214647115d9d50dc008b2ce27ea3a9c8e875e9
Ticket: 8f0ff730836505e298defe424329cd0fb9527efc
tcllibc and sha256c leads to error "Headers for API sha256c not found in"
User & Date: pooryorick 2025-07-03 10:47:01
Changes

  1. comment changed to:
    After removing ~/.critcl, the following script,
    
    <code><verbatim>
    package require critcl
    package require sha256
    package require sha256c
    ::critcl::tcl 9.0 
    ::critcl::ccode {}
    ::critcl::api import sha256c 1
    </verbatim></code>
    
    , results in the error:
    
    <code><verbatim>
    Headers for API sha256c not found in 
    -       /path/to/.critcl/linux-unknown-x86_64
        while executing
    "error "Headers for API $name not found in \n-\t[join $searched \n-\t]""
        (procedure "::critcl::APIimport" line 24)
        invoked from within
    "::critcl::APIimport /path/to/testcript sha256c 1"
        ("eval" body line 1)
        invoked from within
    "eval [linsert $args 0 ::critcl::API$cmd $file]"
        (procedure "::critcl::api" line 10)
        invoked from within
    "::critcl::api import sha256c 1"
    </verbatim></code>
    
    With the following modification the script completes successfully :
    
    <code><verbatim>
    --- modules/sha1/sha256.tcl
    +++ modules/sha1/sha256.tcl
    @@ -81,12 +81,12 @@
             tcl {
                 # Already present (this file)
                 set r 1
             }
             critcl {
    -            if {![catch {package require tcllibc}]
    -                || ![catch {package require sha256c}]} {
    +            if {
    +                ![catch {package require sha256c}]} {
                     set r [expr {[info commands ::sha2::sha256c_update] != {}}]
                 }
             }
             default {
                 return -code error "invalid accelerator $key:\
    </verbatim></code>
    
    The issue is that if [package require tcllibc] is executed first, then
    [package require sha256c] does not lead to the evaluation of sha256c.tcl, and
    therefore the line "critcl::cheaders sha256.h" is never encountered.
    
  2. login: "pooryorick"
  3. mimetype: "text/plain"