| Ticket UUID: | 935ac3b65b3e40483a22caebb61222b6aa18a35e | |||
| Title: | tcllibc 1.21 sha256 compile fails with MS C | |||
| Type: | Bug | Version: | 1.21 | |
| Submitter: | apnadkarni | Created on: | 2022-06-10 07:26:30 | |
| Subsystem: | (unused) | Assigned To: | ||
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2026-11-21 08:42:18 | |
| Resolution: | Fixed | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-11-21 08:42:16 | |||
| Description: |
The actual error: ``` Fri Jun 10 12:07:10 IST 2022 - D:/tcl/magic/lib/tcllib1.21/sha1/sha256c.tcl cl -nologo -c -DTCL_BYTE_ORDER=1234 -DBUILD_sha256c -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_READDIR_R=1 -DTCL_THREADS=1 -DUSE_TCL_STUBS -ID:/ashok/Documents/.critcl/win32-x86_64/tcl8.4 -ID:/ashok/Documents/.critcl/win32-x86_64 -ID:/tcl/magic/lib/tcllib1.21/sha1 -FoD:/ashok/Documents/.critcl/win32-x86_64/v3118_d5dc2c58245d89dba01c62678a3691eb_pic.obj D:/ashok/Documents/.critcl/win32-x86_64/v3118_d5dc2c58245d89dba01c62678a3691eb.c -W3 -O2 -MD -GS -fp:strict -DNDEBUG v3118_d5dc2c58245d89dba01c62678a3691eb.c D:/ashok/Documents/.critcl/win32-x86_64\sha256c/sha256cDecls.h(40): error C2375: 'SHA256Init': redefinition; different linkage d:\ashok\documents\.critcl\win32-x86_64\sha256c\sha256.h(78): note: see declaration of 'SHA256Init' D:/ashok/Documents/.critcl/win32-x86_64\sha256c/sha256cDecls.h(42): error C2375: 'SHA256Update': redefinition; different linkage d:\ashok\documents\.critcl\win32-x86_64\sha256c\sha256.h(79): note: see declaration of 'SHA256Update' D:/ashok/Documents/.critcl/win32-x86_64\sha256c/sha256cDecls.h(45): error C2375: 'SHA256Final': redefinition; different linkage d:\ashok\documents\.critcl\win32-x86_64\sha256c\sha256.h(80): note: see declaration of 'SHA256Final' ERROR while compiling code in D:/tcl/magic/lib/tcllib1.21/sha1/sha256c.tcl: child process exited abnormally critcl build failed (D:/tcl/magic/lib/tcllib1.21/sha1/sha256c.tcl) ``` The problem seems to be that the stubs declaration prototypes are generated as ``` EXTERN void SHA256Init(SHA256Context *sc); /* 1 */ EXTERN void SHA256Update(SHA256Context *sc, const void *data, uint32_t len); /* 2 */ EXTERN void SHA256Final(SHA256Context *sc, uint8_t *hash); ``` (so with dll external linkage) while the sha256.h BSD file defines them as ``` void SHA256Init (SHA256Context *sc); void SHA256Update (SHA256Context *sc, const void *data, uint32_t len); void SHA256Final (SHA256Context *sc, uint8_t hash[SHA256_HASH_SIZE]); ``` (i.e. internal linkage). /Ashok | |||
| User Comments: |
serhiy.storchaka added on 2026-11-21 08:42:18:
Fixed on trunk by [d69b5f3fd3] (merged in [cc4d362b78]), which removed the duplicate declarations from sha256.h. Checked with MSVC 2022: tcllib 1.21 gives exactly these C2375 errors, trunk builds tcllibc (Tcl 8.6.18 and 9.1) and the sha256 accelerator works. The fix is not in a release yet (2.0 still has the declarations). Branch sha256-vc-fix is no longer needed. apnadkarni added on 2022-06-10 12:38:26: I've committed a patch to sha256-vc-fix branch. I'm not entirely happy with the patch as I don't think duplicating declarations is ever a good idea. But given the conflicting definition is dynamically generated as part of stubs I'm not sure what the correct solution is and don't have the time to go into it further. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki