Skip to content
Tcl Source Code History Of Ticket 844b0ebe515862ee
Login

History Of Ticket 844b0ebe515862ee

Artifacts Associated With Ticket 844b0ebe515862ee

  1. Ticket change [5801f0c38f] (rid 235215) by anonymous on 2024-11-19 15:52:02:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      First of all, I'd like to point out that I'm not an expert in compilation and that the words I'm likely to use may not be the right ones. Sorry about that.   
      
      My context:  
      - I'm interfacing **Tcl** with a program written in the **Nim** language.    
      - I don't use autotools like the following link [Building with autotools](https://core.tcl-lang.org/tcl/wiki?name=Migrating%20C%20extensions%20to%20Tcl%209)  
      - OS : Windows and/or MacOS
      - Compiler : GCC and/or MSVC
      
      Since version **9**, I've been getting an error message like the one in my summary message.   
      On the Tcl chat I was told that it indicates an issue related to mismatched or incompatible versions of Tcl/Tk libraries.   
      May be a problem because I have several versions of Tcl (Tcl**86** + Tcl**9**).
      
      To check that my problem wasn't due to the fact that I had 2 versions installed, I ran my program via **Github actions** on latest Windows.
       
      - Init MSVC
      - Download Tcl source
      - Build Tcl with nmake
        - cd tcl9.0.0/win
        - nmake -f makefile.vc INSTALLDIR=C:/dev/Tcl90
        - nmake -f makefile.vc install INSTALLDIR=C:/dev/Tcl90
      - Install Nim
      - Compile my Nim program
      - Execute Tcl code :
        - C:/dev/Tcl90/bin/tclsh90.exe test.tcl
      
      I got the same error message: _interpreter uses an incompatible stubs mechanism_
              
      At compile time my **Nim** program just links the **tclstub.lib** (-ltclstub) library and I don't use anything else.
      
      I'm opening this ticket because I didn't have this problem with **tclstub86.lib** library by using the same method.
         
      My question:   
      Is the error message may be related to something else? Other than the 2 versions of Tcl installed.
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "09c930666be5f16f66385ff2c54c7816bbb4dfd4"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "53. Configuration and Build Tools"
    15. title initialized to:
      tclstub : interpreter uses an incompatible stubs mechanism
      
    16. type initialized to: "Bug"
  2. Ticket change [b4350b42a9] (rid 235227) by jan.nijtmans on 2024-11-20 08:45:52:

    1. icomment:
      I suspect that one of the Nim shared libraries was compiled with Tcl 8.6 header-files. When used with Tcl 9.0, they must be re-compiled (after some modifications) against Tcl 9.0 headers.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [46b72b2090] (rid 235258) by anonymous on 2024-11-21 10:25:30:

    1. icomment:
      I hope I understand your response correctly.   
      I didn't think it could go this far !!
        
      I'm unable to find out in which libraries the **tcl.h** header file may have been used and if I could miraculously figure it out, I don't even know if I could change the structure of the Nim language (but it's another problem).   
      
      I only see this librairies, there may be others: 
      ```
      7-zip.dll
      7z.dll
      boehmgc.dll
      boehmgc64.dll
      libcrypto-1_1-x64.dll
      libcrypto-1_1.dll
      libcurl.dll
      libpng12.dll
      libpng3.dll
      libssl-1_1-x64.dll
      libssl-1_1.dll
      libui.dll
      pcre.dll
      pcre3.dll
      pcre32.dll
      pcre64.dll
      pdcurses.dll
      pdcurses32.dll
      pdcurses64.dll
      png.dll
      SDL2.dll
      SDL2_ttf.dll
      sqlite3_32.dll
      sqlite3_64.dll
      zlib1.dll
      ```
      Maybe you know these libraries ? and know if any of them use **tcl.h**
      
      Thanks for the support
      
    2. login: "anonymous"
    3. mimetype: "text/x-markdown"
  4. Ticket change [0c4207a1ec] (rid 235347) by jan.nijtmans on 2024-11-22 14:08:57:

    1. icomment:
      > Maybe you know these libraries ? and know if any of them use tcl.h
      
      None of those use tcl.h.
      
      Still, some library is 'load'ed from Tcl 9.0, which is compiled with Tcl 8.6 headers. The challenge is to find out which library is responsible for that.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [b64ecf9252] (rid 235435) by anonymous on 2024-11-25 12:46:35:

    1. icomment:
      > Still, some library is 'load'ed from Tcl 9.0, which is compiled with Tcl 8.6 headers. The challenge is to find out which library is responsible for that.
      
      How can I help you ?
      
    2. login: "anonymous"
    3. mimetype: "text/x-markdown"
  6. Ticket change [7f74d89258] (rid 235479) by apnadkarni on 2024-11-26 17:32:51:

    1. icomment:
      Nico, Can you post a link to your github action that demonstrates the issue?
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  7. Ticket change [16cbc11861] (rid 235481) by anonymous on 2024-11-26 20:10:02:

    1. icomment:
      > Nico, Can you post a link to your github action that demonstrates the issue?
      
      Github workflows [Tcl 9](https://github.com/nico-robert/tclnimtest/actions/runs/12038087743/job/33562963686).  
      Github  workflows [Tcl 8.6](https://github.com/nico-robert/tclnimtest/actions/runs/12038087747/job/33562963705).  
      
      Thanks
      
    2. login: "anonymous"
    3. mimetype: "text/x-markdown"
  8. Ticket change [05fa001585] (rid 235482) by jan.nijtmans on 2024-11-26 20:42:10:

    1. icomment:
      <pre>
      interpreter uses an incompatible stubs mechanism
          while executing
      "load C:/temp/pix90.dll Pix"
      </pre>
      
      It helps to display the full error-message :-)
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  9. Ticket change [6d47a97195] (rid 235496) by apnadkarni on 2024-11-27 02:50:56:

    1. icomment:
      Nico,
      
      The error occurs because the *actual* C function `Tcl_InitStubs` has changed in Tcl 9. It now takes 4 parameters, not 3 as in 8.6.
      
      As *documented* for Tcl 9, the function still has only 3 parameters but [these](https://core.tcl-lang.org/tcl/file?ci=tip&name=generic/tcl.h&ln=2325-2363) macros in tcl.h redefine to a call with 4 parameters with the fourth hardcoded as TCL_STUB_MAGIC.
      
      So you need to change [this line](https://github.com/nico-robert/tclnimtest/blob/7790fd10633f02cc519af1bead59e7405db15d0d/src/tcl9pix/tcl9pix.nim#L12) in your Nim definition accordingly (passing in TCL_STUB_MAGIC as the fourth parameter).
      
      I learnt something new too :-)
      
      /Ashok
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  10. Ticket change [de1e3c9210] (rid 235888) by apnadkarni on 2024-12-10 10:10:23:

    1. closedate changed to: "2460654.92388838"
    2. closer changed to: "apnadkarni"
    3. login: "apnadkarni"
    4. mimetype: "text/plain"
    5. resolution changed to: "Invalid"
    6. status changed to: "Closed"
  11. Ticket change [20e416e34b] (rid 235889) by anonymous on 2024-12-11 12:44:22:

    1. closedate changed to: "2460656.03082101"
    2. closer changed to: "anonymous"
    3. icomment:
      Ashok, 
      
      > The error occurs because the *actual* C function `Tcl_InitStubs` has changed in Tcl 9. It now takes 4 parameters, not 3 as in 8.6.
      
      I used this value to define :
      ```
      TCL_STUB_MAGIC ((int) 0xFCA3BACB + (int) sizeof(void *))
      ```
      
      Unfortunately for me this still doesn't work, same error : _"interpreter uses an incompatible stubs mechanism"_, where I'm surprised is that I didn't have a 'segmentation fault' rather than the usual error. 
      
      Unless _tclstub.lib_ automatically defines this pragma : __USE_TCL_STUBS__
      I think I'm in that [case](https://core.tcl-lang.org/tcl/file?ci=tip&name=generic/tcl.h&ln=2362-2366) in tcl.h.   
      If I'm right I end up with almost the same configuration defined in Tcl8.X which is defined like this in tcl8.X.h :  
       
      ```
      #ifndef USE_TCL_STUBS
      #define Tcl_InitStubs(interp, version, exact) \
          Tcl_PkgInitStubsCheck(interp, version, exact)
      #endif
      ```   
      
      As you well know, I don't know __C__ and I'm learning the __Nim__ language.   
      I'll try to get in contact with a Nim expert to make sure I've defined the right things.   
      
      In any case, thank you for going outside the scope of my question and looking into my code. 
      
      Thanks (again)
      
    4. login: "anonymous"
    5. mimetype: "text/x-markdown"
  12. Ticket change [81332d2be4] (rid 236733) by anonymous on 2025-01-10 10:43:55:

    1. closedate changed to: "2460685.94716688"
    2. icomment:
      I think my torture ends today! (until the next problem!)   
      
      I know this isn't a chat room, but I wanted to keep you up to date on my project to use**Tcl8.6** to **Tcl9** with the **Nim** language.   
      
      As I said in my previous messages with **Tcl8.6**, I just had to link this library: **tclstub86.lib** and nothing else.
      
      Simply linking the library is no longer enough with **Tcl/Tk9** it's a different story :
       - Include Tcl.h + tclDecls.h 
       - Pass option to the C compiler : -DUSE_TCL_STUBS
       - link tclstub(90).lib
      
      This may be normal behavior, but without using **-DUSE_TCL_STUBS**, I had this error :  undefined reference to set up **Tcl_PkgInitStubsCheck**
      
      I wanted at all costs not to use all these flags, but in the end I had to force myself to do it.
      
      This message: *"interpreter uses an incompatible stubs mechanism"* was not the problem, It was different, I don't know if another message would have helped me more easily.   
      
      
      For the moment, I don't have a solution as simple as the one I had with **Tcl8.6**.
      
      Thanks Ashok for helping me on the chat and here.   
      Sorry Jan for taking your time to answer this ticket.
      
    3. login: "anonymous"
    4. mimetype: "text/x-markdown"
  13. Ticket change [633fdaa9bb] (rid 236734) by jan.nijtmans on 2025-01-10 11:34:05:

    1. closedate changed to: "2460685.98200627"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Nicolas, I'm glad it finally worked out for you.
      
      The stubs mechanism is implemented as macro's in tclDecls.h. So I'm surprised that it worked in Tcl 8.6 without using tclDecls.h. My guess is that you linked with tcl86.lib as well, and just called everything directly. In that case, the stub table is not used, so there is no need to initialize it with Tcl_InitStubs().
      
      Short: In Tcl 8.6 you should have used the same method as you have now for 9.0.
      
      Good luck!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"