all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: claudio.bley@gmail.com (Claudio Bley)
To: emacs-devel@gnu.org
Subject: build fails with new MinGW wchar.h
Date: Wed, 20 Nov 2013 08:24:06 +0100	[thread overview]
Message-ID: <87d2lvv8mh.wl%claudio.bley@gmail.com> (raw)

Hi.

When trying to build emacs on w32 using the latest MinGW, the build
failed for some reason I can't remember (something about mbstate_t
being defined twice).

Basically, it was because configure determined that the MinGW headers
did not define mbstate_t in wchar.h which is actually wrong.

The configure test failed with this error message:

---------------------------------------------------------------------------------------------------------------
c:\mingw\include\wchar.h:816:32: error: conflicting types for '_wstat64i32'
 __CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat)
                                ^
c:\mingw\include\wchar.h:814:29: note: previous declaration of '_wstat64i32' was here
 int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*);
                             ^
c:\mingw\include\wchar.h: In function '_wstat64i32':
c:\mingw\include\wchar.h:818:20: error: storage size of 'st' isn't known
     struct _stat64 st;
                    ^
c:\mingw\include\wchar.h:821:31: error: invalid application of 'sizeof' to incomplete type 'struct _stat64i32'
       memset(_stat, 0, sizeof(struct _stat64i32));
                               ^
c:\mingw\include\wchar.h:824:10: error: dereferencing pointer to incomplete type
     _stat->st_dev = st.st_dev;
          ^
c:\mingw\include\wchar.h:825:10: error: dereferencing pointer to incomplete type
     _stat->st_ino = st.st_ino;
          ^
c:\mingw\include\wchar.h:826:10: error: dereferencing pointer to incomplete type
     _stat->st_mode = st.st_mode;
          ^
c:\mingw\include\wchar.h:827:10: error: dereferencing pointer to incomplete type
     _stat->st_nlink = st.st_nlink;
          ^
c:\mingw\include\wchar.h:828:10: error: dereferencing pointer to incomplete type
     _stat->st_uid = st.st_uid;
          ^
c:\mingw\include\wchar.h:829:10: error: dereferencing pointer to incomplete type
     _stat->st_gid = st.st_gid;
          ^
c:\mingw\include\wchar.h:830:10: error: dereferencing pointer to incomplete type
     _stat->st_rdev = st.st_rdev;
          ^
c:\mingw\include\wchar.h:831:10: error: dereferencing pointer to incomplete type
     _stat->st_size = (_off_t) st.st_size;
          ^
c:\mingw\include\wchar.h:832:10: error: dereferencing pointer to incomplete type
     _stat->st_atime = st.st_atime;
          ^
c:\mingw\include\wchar.h:833:10: error: dereferencing pointer to incomplete type
     _stat->st_mtime = st.st_mtime;
...
---------------------------------------------------------------------------------------------------------------

The wchar.h header was installed from mingwrt-4.0.3-1-mingw32-dev:

,----[ wchar.h ]
| /**
|  * @file wchar.h
|  * Copyright 2012, 2013 MinGW.org project
`----

It duplicates definitions from sys/stat.h instead of including that file,
conflicting with the overrides from nt/inc/sys/stat.h if both are included:

,----[ wchar.h ]
| /* @TODO: Use sys/stat.h to define these instead of duplicated code. */
| #ifndef _STAT_DEFINED 
| ...
| #endif
| ...
| #if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */ 
| ...
`----

This patch fixes it for me:

---- 8< -------- >8 ---------------- 8< ------------- >8 -------------
diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h
index f1d8341..88352b1 100644
--- a/nt/inc/sys/stat.h
+++ b/nt/inc/sys/stat.h
@@ -23,6 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */

 #ifdef __MINGW32__
 # include <_mingw.h>
+# define _STAT_DEFINED
+# define _WSTAT_DEFINED
 #endif

 /* Only MinGW 3.13 and later has __MINGW_NOTHROW.  */
---- 8< -------- >8 ---------------- 8< ------------- >8 -------------

-- 
Claudio




             reply	other threads:[~2013-11-20  7:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20  7:24 Claudio Bley [this message]
2013-11-20 18:15 ` build fails with new MinGW wchar.h Eli Zaretskii
2013-11-21  7:36   ` Claudio Bley
2013-11-21 17:36     ` Eli Zaretskii
2014-01-11 14:50     ` Eli Zaretskii
2014-01-14 10:28       ` Claudio Bley

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

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

  git send-email \
    --in-reply-to=87d2lvv8mh.wl%claudio.bley@gmail.com \
    --to=claudio.bley@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.