View Ticket
Not logged in
Ticket UUID: ee9501624a9fdc5ec0aae2062c70cffdf1fdf5c2
Title: Improve cross-compilability
Type: Patch Version: 8.5.14
Submitter: anonymous Created on: 2014-01-28 11:46:02
Subsystem: 53. Configuration and Build Tools Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2014-02-24 15:02:07
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2014-02-24 15:02:07
Description:
Hi,

To be able to cross compile Tcl 8.5.14 on Linux with MinGW for Windows, I have to apply the following patch:

diff -ru tcl8.5.14.orig/generic/tcl.h tcl8.5.14/generic/tcl.h
--- tcl8.5.14.orig/generic/tcl.h        2013-03-22 12:39:05.000000000 +0100
+++ tcl8.5.14/generic/tcl.h     2013-05-26 09:28:57.000000000 +0200
@@ -168,7 +168,7 @@
  *       MSVCRT.
  */
 
-#if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
+#if (defined(__WIN32__) && (defined(_MSC_VER) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0550)) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
 #   define HAVE_DECLSPEC 1
 #   ifdef STATIC_BUILD
 #       define DLLIMPORT


I hope you can include this patch, so that I don't have to apply it over and over again :)

I also have to apply the following for some reasons unknown to me, maybe you an help me understand why:
diff -ru tcl8.5.14.orig/win/Makefile.in tcl8.5.14/win/Makefile.in
--- tcl8.5.14.orig/win/Makefile.in      2013-04-01 20:36:36.000000000 +0200
+++ tcl8.5.14/win/Makefile.in   2013-05-26 09:34:41.000000000 +0200
@@ -606,7 +606,7 @@
            $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
            fi
 
-install-libraries: libraries install-tzdata install-msgs
+install-libraries: libraries
        @for i in $(prefix)/lib $(INCLUDE_INSTALL_DIR) \
                $(SCRIPT_INSTALL_DIR); \
            do \
 and

--- tcl8.5.14.orig/unix/configure       2013-04-01 20:36:35.000000000 +0200
+++ tcl8.5.14/unix/configure    2013-05-26 09:28:57.000000000 +0200
@@ -15068,7 +15068,7 @@
 else
 
            if test "$cross_compiling" = yes; then
-  tcl_cv_strtod_buggy=buggy
+  tcl_cv_strtod_buggy=ok
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */


I hope to hear from you soon.
User Comments: jan.nijtmans added on 2014-02-06 21:53:48:

The first part of the patch I agree with: Existance of the __BORLANDC__ macro should be checked before using it. Modern gcc doesn't groc on that but older mingw compilers might.

The other two patches are wrong: the "install-tzdata" and "install-msgs" work fine in cross-compile situation, only Tcl needs to be installed on the host BEFORE starting the cross-compile. The last patch has no relation at all to the Windows build, because it is for the UNIX configure script. Apart from that, when cross-compiling there is no way to check whether strtod is buggy, the best that can be assumed is that it is buggy, so Tcl uses its replacement.

First part applied to core-8-5-branch and trunk. I regularly cross-compile Tcl for Win32/Win64 on Linux, and as far as I know it work fine. But I'm using either MinGW-w64 or MinGW-4, I don't use MinGW-3 any more.