Compiling Tcl/Tk with mingw-w64

Kish Shen
2009-02-23
2013-06-06
  • Kish Shen
    Kish Shen
    2009-02-23

    Hi,

    I am having some problems compiling Tcl/Tk (8.5.6) with mingw-w64 -- I have been able to compile Tcl/Tk with mingw for 32 bit Windows, but for 64 bit Windows, I am having problems because some of the windows specific source files
    in the <Tcl>win directory contain x86 assembler code.

    The assembler code is in  tclWinChan.c and tclWinFCmd.c, as a substitute for structured exception handling (SEH) code, which apparently not supported by MinGW/gcc.

    Does anyone know a way to work around this, either by converting the assembler code to x86-64, or by coding in C the equivalent to SEH?

    Thanks in advance for any help and information!

    Kish Shen

     
    • NightStrike
      NightStrike
      2009-02-23

      We had provided patches to the tcl maintainers to support this, bu the patches were never accepted.

       
    • Kai Tietz
      Kai Tietz
      2009-02-23

      You can remove all this SEH stuff for w64. Those checkings are meaningless for x64 windows. Those tested failure cases can happen on 64-bit windows.

      Cheers,
      Kai

       
    • Kish Shen
      Kish Shen
      2009-02-23

      Thanks for your quick replies!

      I assume removing the SEH stuff in tclWinFCmd.c means that I should replace it with a "return TCL_OK;" in DoRenameFile()? This is because otherwise the code falls through to what looks like error handling code, as retval is set to -1 (which I assume the SEH stuff was supposed to change to TCL_OK normally).

      With these changes, I was able to compile tcl (8.5.6) with 'make', and generate a tchsh85.exe. However, make install then fails in [install-tzdata] with Error 128, and when I try to run tclsh85.exe, the execution appears to hang, and I never get the Tcl shell prompt.

      Any ideas what I may be doing wrong? Has anyone been successful in compiling Tcl 8.5?

      Cheers,

      Kish

       
    • Kish Shen
      Kish Shen
      2009-02-24

      Hi,

      An update: I redid the modification to remove the SEH stuff, keeping the code inside the __try instead of removing the whole __try. It also turned out that the tclsh was hanging because I was  loged in to the Win64 machine remotely via bash, and tclsh was poping up a window on
      the main display.    I also had to do copy the tzdata and msgs directories manually to get the make install to work.

      After this, I compiled tk. I had to modify the source in a couple of place, because the code
      for MinGW seem quite out-of-date -- for example, I had to remove various #define that are now provided by MinGW-W64 itself.

      This generated a wish85.exe after make install, but I am unable to run this. When I run it by clicking on its icon, I get a message that says the application configuration is incorrect. When I try to run wish85.exe from a bash shell, I get a permission denied error, even though there does seem to be execute permissions on the file.

      cygwin (32 bit, I assume) is installed on the system, with tcl/tk 8.4 -- this I can run from the bash shell.

      Does anyone know what the problem might be, or have a 64 bit Windows compile for Tcl/Tk?

      Thanks in advance for any more information!

      Cheers,

      Kish

       
    • Kish Shen
      Kish Shen
      2009-02-24

      I should have mentioned: I compiled with CFLAGS="-mno-cygwin"

       
      • Kai Tietz
        Kai Tietz
        2009-02-24

        well, if you use our cross-compiler toolchain for w64, there is no need to use the -mno-cygwin switch.

        You permissions denied failure seems to be reasoned by meta information. Are you using a manifest? If so please verify, if it is proper for amd64 (you can remove this resource for testing).

        Cheers,
        Kai

         
    • Kish Shen
      Kish Shen
      2009-02-24

      Hi Kai,

      Thanks for your help again. There was indeed a wish85.exe.manifest that configure generates, and which for gcc, configure is apparently hardcoded to compile for 32 bit only.
      I changed the configure script so that the manifest file now set processorArchitecture to AMD64 instead of X86 -- this appears to be the only variable in the manifest.in file, i.e. the only thing that configure is able to set for the manifest file. The `type' is set to win32 in the file.

      The configure also specifies various library files with the -l flag -- are there any 64 windows specific libraries that needed to be loaded in, that I need to add to the configure

      I have regenerated wish85.exe and the .dll files, but it still give the same errors when I try to run it. As far as I can tell, the Makefile does nothing with the manifest file -- it certainly is not copied to the final bin directory. What do I need to do to get the meta information correct?

      Thanks again,

      Kish

       
      • Kai Tietz
        Kai Tietz
        2009-02-24

        well, you can find some examples on msdn for your manifest file.
        The manifest is normally compiled as resource by windres. So you have to regenerate all your dll's and your wish app by using the correct manifest.

        Cheers,
        Kai

         
    • Kish Shen
      Kish Shen
      2009-02-24

      Thanks for your help. I am now able to run the (hopefully) 64bit tcl/tk at last!

      Cheers,

      Kish

       
      • Kai Tietz
        Kai Tietz
        2009-02-24

        Nice to hear.

        You can verify it pretty simple. Just open the task-manager and check for a asterisk on process name. If there is none, it should be a 64-bit application ;)

        Cheers,
        Kai