Ticket UUID: | 8f0ff730836505e298defe424329cd0fb9527efc | |||
Title: | tcllibc and sha256c leads to error "Headers for API sha256c not found in" | |||
Type: | Bug | Version: | ||
Submitter: | pooryorick | Created on: | 2024-09-17 11:28:24 | |
Subsystem: | sha1 | Assigned To: | aku | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2024-09-20 21:48:46 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | ||||
Description: |
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 ecxecuted 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. | |||
User Comments: |
aku added on 2024-09-20 21:48:46:
The only change done so far was the changed search order, i.e. sha256c before tcllibc. Hm. pooryorick added on 2024-09-20 21:28:06: The "package forget sha256c" trick no-longer works. In fact, I had to remove it to avoid this error:
aku added on 2024-09-19 13:56:00: Option At the
for the code handling the
The main issue seems to be to get a proper match between where the include files were stored during build of Tcllibc/Sha256c, and where the include files are searched at when compiling the othr package. And that is configurable with either options, when the aku added on 2024-09-19 08:16:05: The headers are installed when Running the command
This places the generated tcllibc package into This is noted in the output of
I believe that the If you do not specify the lib- and include dir Examples:
Notes:
pooryorick added on 2024-09-19 05:32:24: Would the "real solution" be something like generating tcllibc/pkgIndex.tcl in such a way that in addition to loading the shared object it also makes relevant header files available to critcl somehow? aku added on 2024-09-17 19:39:10: For now I have committed the search order tweak, see commit [692adc1efb]. Bumped to version 1.0.6 aku added on 2024-09-17 19:29:54: Real solution. Heh. ... Currently letting this simmer in the back of my mind. I was about to write that the issue is a consequence of tcllibc a superset/bundle of all the individual accelerators present in Tcllib. Then I decided to check something. Running Grepping for
Nothing for anything else with an accelerator. Playing interactively with the tcllibc shlib:
Confirmed. It seems that sha256c is the only module which registers itself within the bundled tcllibc. Nothing else looks to be. And the difference looks to be that the sha256c has This triggers the addition of the Adding a temp fake stubs table to sha1, and it gets a And your demo case absolutely desires (to import) the stubs table of sha256. We cannot get rid of this provide call. Without it the stubs table is not registered, and the corresponding No ideas coming yet beyond the known For sha256c it is indeed the issue that both sha256c and tcllibc will register the sha256c package for stub table support. pooryorick added on 2024-09-17 14:54:40:
My use case is the latter: compile-at runtime. aku added on 2024-09-17 14:17:18: Ah. The Is your situation the ahead-of-time compilation of a package using sha256c ? Or is it using critcl/sha256c in compile-at-runtime mode ? From the description it looks it feels to be latter. However it may simply be the reduction of your larger test case. You could try to put a However, when a tcllibc was loaded before, then the forget should cancel the pooryorick added on 2024-09-17 13:27:12: Yes, as long as sha256c is required before tcllibc is required, then things are fine. The problem with that, of course, is that my own package can't control whether someone else requires tcllibc before requiring my package. aku added on 2024-09-17 11:41:53: Does it work if the test for tcllibc is left in, just done after sha256c ? |
