unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: EMACS devel list <emacs-devel@gnu.org>
Subject: Latest EMACS on BZR trunk does not compile with MinGW
Date: Tue, 03 Jun 2014 22:00:02 +0200	[thread overview]
Message-ID: <80sinlu5kt.fsf@gmail.com> (raw)

Here is what I get:

dup2.c:35:0: warning: "WIN32_LEAN_AND_MEAN" redefined [enabled by default]
c:/Programme/GNU/installation/emacs-install/emacs/trunk/nt/inc/ms-w32.h:148:0: note: this is the location of the previous definition
dup2.c:38:26: fatal error: msvc-inval.h: No such file or directory
compilation terminated.


msvc-inval.h, given its naming, is probably a file from the MS Visual C
compiler suite, it seems that it is not available with MinGW --- at
least with the version of the gcc suite installed on my machine.

Here is the problematic piece of code from dup2.c:

-----------------------------------------------------------------------
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__

/* Get declarations of the native Windows API functions.  */
#  define WIN32_LEAN_AND_MEAN
#  include <windows.h>

#  include "msvc-inval.h"

/* Get _get_osfhandle.  */
#  include "msvc-nothrow.h"

static int
ms_windows_dup2 (int fd, int desired_fd)
{
  int result;

  /* If fd is closed, mingw hangs on dup2 (fd, fd).  If fd is open,
     dup2 (fd, fd) returns 0, but all further attempts to use fd in
     future dup2 calls will hang.  */
  if (fd == desired_fd)
    {
      if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
        {
          errno = EBADF;
          return -1;
        }
      return fd;
    }

  /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
     http://bugs.winehq.org/show_bug.cgi?id=21289 */
  if (desired_fd < 0)
    {
      errno = EBADF;
      return -1;
    }

  TRY_MSVC_INVAL
    {
      result = dup2 (fd, desired_fd);
    }
  CATCH_MSVC_INVAL
    {
      errno = EBADF;
      result = -1;
    }
  DONE_MSVC_INVAL;

  if (result == 0)
    result = desired_fd;

  return result;
}

#  define dup2 ms_windows_dup2

# endif
-----------------------------------------------------------------------

Maybe the  

 `&& ! defined __CYGWIN__'

wherever used in this file for this topic should be replaced by

`&& defined _MSC_VER' 

or something like that --- I cannot remember exactly the #definition
that one can use to detect MSVC compiler.

An alternative would be to use

`&& ! defined __CYGWIN__ && ! defined __MINGW32__'

but well, if the msvc_xxx.h file are MSVC specific, I would prefer the
other one.

VBR,
   Vincent.



             reply	other threads:[~2014-06-03 20:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 20:00 Vincent Belaïche [this message]
2014-06-03 20:22 ` Latest EMACS on BZR trunk does not compile with MinGW Paul Eggert
2014-06-03 20:56   ` Óscar Fuentes
2014-06-03 21:15   ` Eli Zaretskii
2014-06-03 21:21     ` Vincent Belaïche
2014-06-04  6:47       ` Eli Zaretskii
2014-06-04 13:17         ` Vincent Belaïche
2014-06-04 13:31           ` Eli Zaretskii
2014-06-04 15:28             ` Vincent Belaïche
2014-06-04 15:44               ` Eli Zaretskii
2014-06-04 15:54                 ` Dani Moncayo
2014-06-04 16:05                   ` Eli Zaretskii
2014-06-04 21:50                     ` Dani Moncayo
2014-06-05  0:42                       ` Stefan Monnier
2014-06-05  2:51                         ` Eli Zaretskii
2014-06-05  3:40                           ` Óscar Fuentes
2014-06-05  7:03                             ` Dani Moncayo
2014-06-05  9:03                               ` Vincent Belaïche
2014-06-05 15:09                                 ` Eli Zaretskii
2014-06-05 14:51                             ` Eli Zaretskii
2014-06-05 16:19                               ` Óscar Fuentes
2014-06-05 17:52                                 ` Eli Zaretskii
2014-06-05 13:31                           ` Stefan Monnier
2014-06-05 15:15                             ` Eli Zaretskii
2014-06-05 16:50                               ` Stefan Monnier
2014-06-05 18:07                                 ` Eli Zaretskii
2014-06-05 19:35                                   ` Paul Eggert
2014-06-05 19:54                                     ` Eli Zaretskii
2014-06-10 19:25                                     ` Dani Moncayo
2014-06-10 20:21                                       ` Eli Zaretskii
2014-06-05 20:54                                   ` Stefan Monnier
2014-06-05  2:47                       ` Eli Zaretskii
2014-06-04 12:22     ` Using Qunsupported__w32_dialog Dmitry Antipov
2014-06-04 13:09       ` Eli Zaretskii
2014-06-04 13:37         ` Dmitry Antipov
2014-06-04 13:47           ` Eli Zaretskii
2014-06-04 14:06             ` Eli Zaretskii
2014-06-03 21:14 ` Latest EMACS on BZR trunk does not compile with MinGW Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80sinlu5kt.fsf@gmail.com \
    --to=vincent.b.1@hotmail.fr \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).