bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19111: 25.0.50; 32 bits temacs.exe is linked with wrong image-base w


From: Dani Moncayo
Subject: bug#19111: 25.0.50; 32 bits temacs.exe is linked with wrong image-base when built on 64 bit Windows host
Date: Sat, 29 Nov 2014 11:07:14 +0100

Hello,

I have to say that I still don't like the way of determining the host
platform on MinGW builds, because we are setting $host and $canonical
to a value (the compiler's target) that is not guaranteed to be
canonical (and in fact is not canonical in the cases I've tried, see
below).

The following table shows the canonical host (as given by
'build-aux/config.guess') and gcc target taken from the 5 different
build environments for MS-Windows I know of:

#  MSYS type     $MSYSTEM   canonical host      gcc target
-  -----------   --------   -----------------   ------------------
1  MSYS          MINGW32    i686-pc-mingw32     mingw32
2  MSYS2-32bit   MINGW32    i686-pc-mingw32     i686-w64-mingw32
3  MSYS2-32bit   MINGW64    i686-pc-mingw64     x86_64-w64-mingw32
4  MSYS2-64bit   MINGW32    x86_64-pc-mingw32   i686-w64-mingw32
5  MSYS2-64bit   MINGW64    x86_64-pc-mingw64   x86_64-w64-mingw32
------------------------------------------------------------------

As you can see, our problem is only in the environments 3 and 4, where
the first part of the canonical triplet (CPU in CPU-VENDOR-OS) is not
what we want.

But note that this problem is easily fixable: the CPU we want can be
deduced from the OS part of the triplet:
* mingw32 --> i686
* mingw64 --> x86_64

The following patch (also attached) is an attempt to fix this.

WDYT?

diff --git a/configure.ac b/configure.ac
index 010abc8..d7a17f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,32 +142,18 @@ case $host in
  *-mingw*)

   if test -z "$host_alias"; then
-
-      # No --host argument was given to 'configure'; therefore $host
-      # was set to a default value based on the build platform.  But
-      # this default value may be wrong if we are building from a
-      # 64-bit MSYS[2] pre-configured to build 32-bit MinGW programs.
-      # Therefore, we'll try to get the right host platform from the
-      # compiler's target.
-
-      AC_MSG_CHECKING([the compiler's target])
-      if test -z "$CC"; then
-  cc=gcc
-      else
-  cc=$CC
-      fi
-      cc_target=`$cc -v 2>&1 | sed -n 's/Target: //p'`
-      case "$cc_target" in
-          *-*) host=$cc_target
-      ;;
-          "") AC_MSG_ERROR([Impossible to obtain $cc compiler target.
-Please explicitly provide --host.])
-              ;;
-  *) AC_MSG_WARN([Compiler reported non-standard target.
-Defaulting to $host.])
-              ;;
-      esac
-      AC_MSG_RESULT([$host])
+    # No --host argument was given; therefore $host was set to $build.
+    # But this default value is wrong if we are building from MSYS2
+    # 64-bit with the mingw32 shell, or from MSYS2 32-bit with the
+    # mingw64 shell.  So we have to amend $host in those cases.
+    host1=`AS_ECHO $host | sed \
+      -e 's/x86_64-pc-mingw32/i686-pc-mingw32/' \
+      -e 's/i686-pc-mingw64/x86_64-pc-mingw64/'`
+
+    if test "$host1" != "$host"; then
+      host=$host1
+      AC_MSG_WARN([host system type amended to $host])
+    fi
   fi

   . $srcdir/nt/mingw-cfg.site



-- 
Dani Moncayo

Attachment: tmp.diff
Description: Text document


reply via email to

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