libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cross compilation to w32


From: Charles Wilson
Subject: Re: cross compilation to w32
Date: Sun, 09 Mar 2008 21:23:04 -0500
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

[moved to libtool-patches]

Charles Wilson wrote:

Here's a possible (completely untested) patch.

Using a slightly modified patch (below), with Ralf's latest bugfixes for win32, I obtained the following test results:

native cygwin
======================
All 115 tests passed
(9 tests were not run)
======================
 21: Link order of deplibs.          FAILED (link-order2.at:129)
 66: Run tests with low max_cmd_len  FAILED (cmdline_wrap.at:43)


native mingw/msys
====================================
4 of 109 tests failed
(15 tests were not run)
Please report to address@hidden
====================================
FAIL: tests/demo-exec.test
FAIL: tests/f77demo-static.test
FAIL: tests/f77demo-conf.test
FAIL: tests/f77demo-shared.test
 21: Link order of deplibs.         FAILED (link-order2.at:129)
 25: static linking flags for programs  FAILED (static.at:252)
 53: compiling softlinked libltdl   FAILED (recursive.at:67)
 54: compiling copied libltdl       FAILED (recursive.at:87)
 55: installable libltdl            FAILED (recursive.at:109)
 66: Run tests with low max_cmd_len FAILED (cmdline_wrap.at:43)


As far as I can tell, none of these failures are related to the issues raised in this thread or addressed by this patch. However, I have no way of knowing *for sure* if this patch fixes the cross-compile issues, as I do not have a cross-compile setup for either cygwin or mingw.

2008-03-09  Charles Wilson  <...>

        * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src) [file
        scope]: additional #includes and #defines to support...
        (func_emit_cwrapperexe_src) [main]: ensure stdout is set to
        binary mode for cygwin|mingw builds. Ensure temporary script
        file is written in binary mode for cygwin|mingw builds.
        (func_mode_link) [cygwin|mingw]: cross-build support - only
        use cwrapper to generate shell wrapper if building native;
        otherwise use func_emit_wrapper()
        
--
Chuck


Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.100
diff -u -r1.100 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  9 Mar 2008 14:12:10 -0000       1.100
+++ libltdl/config/ltmain.m4sh  9 Mar 2008 18:11:26 -0000
@@ -2517,6 +2517,7 @@
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
+# include <io.h>
 #else
 # include <unistd.h>
 # include <stdint.h>
@@ -2527,6 +2528,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 
 #if defined(PATH_MAX)
@@ -2560,6 +2562,7 @@
 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
   defined (__OS2__)
 # define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
 # ifndef DIR_SEPARATOR_2
 #  define DIR_SEPARATOR_2 '\\'
 # endif
@@ -2581,6 +2584,17 @@
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 #define XFREE(stale) do { \
   if (stale) { free ((void *) stale); stale = 0; } \
@@ -2646,6 +2660,15 @@
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
        {
+EOF
+           case "$host" in
+             *mingw* | *cygwin* )
+               # make stdout use "unix" line endings
+               echo "          _setmode(1,_O_BINARY);"
+               ;;
+             esac
+
+           cat <<EOF
          printf ("%s", script_text);
          return 0;
        }
@@ -2733,10 +2756,8 @@
   XFREE (shwrapper_name);
   XFREE (actual_cwrapper_path);
 
-  /* note: do NOT use "wt" here! -- defer to underlying
-   * mount type on cygwin
-   */
-  if ((shwrapper = fopen (newargz[1], "w")) == 0)
+  /* always write in binary mode */
+  if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
     {
       lt_fatal ("Could not open %s for writing", newargz[1]);
     }
@@ -6830,7 +6851,12 @@
            $RM $func_ltwrapper_scriptname_result
            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 
2 15
            $opt_dry_run || {
-             $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+             # note: this script will not be executed, so do not chmod.
+             if test "x$build" = "x$host" ; then
+               $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+             else
+               func_emit_wrapper no > $func_ltwrapper_scriptname_result
+             fi
            }
          ;;
          * )

reply via email to

[Prev in Thread] Current Thread [Next in Thread]