unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24613: Windows build with rsvg fails on newest MinGW
@ 2016-10-04 12:12 Nikolay Kudryavtsev
  2016-10-04 14:10 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolay Kudryavtsev @ 2016-10-04 12:12 UTC (permalink / raw)
  To: 24613

I've been trying to get rsvg working and here's what I found:

First, building xml.o fails:
>   CC       xml.o
> In file included from d:/Emacs/source/emacs-25.1/src/conf_post.h:32:0,
>                  from ./config.h:1916,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:149:0: warning: 
> "_WIN32_WINNT" redefined
>  # define _WIN32_WINNT 0x0400
>  ^
> In file included from c:\mingw\include\w32api.h:59:0,
>                  from c:\mingw\include\_mingw.h:73,
>                  from d:/Emacs/source/emacs-25.1/nt/inc/mingw_time.h:13,
>                  from d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:27,
>                  from d:/Emacs/source/emacs-25.1/src/conf_post.h:32,
>                  from ./config.h:1916,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> c:\mingw\include\sdkddkver.h:184:0: note: this is the location of the 
> previous definition
>  #  define _WIN32_WINNT _WIN32_WINNT_WIN2K
>  ^
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from c:\mingw\include\iconv.h:106,
>                  from C:/MinGW/include/libxml2/libxml/encoding.h:28,
>                  from C:/MinGW/include/libxml2/libxml/parser.h:807,
>                  from C:/MinGW/include/libxml2/libxml/globals.h:18,
>                  from C:/MinGW/include/libxml2/libxml/threads.h:35,
>                  from C:/MinGW/include/libxml2/libxml/xmlmemory.h:218,
>                  from C:/MinGW/include/libxml2/libxml/tree.h:1248,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:23:
> c:\mingw\include\sys/stat.h:173:8: error: redefinition of 'struct _stat'
>  struct _stat __struct_stat_defined( _off_t, time_t );
>         ^
> In file included from d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:440:0,
>                  from d:/Emacs/source/emacs-25.1/src/conf_post.h:32,
>                  from ./config.h:1916,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:106:8: note: originally 
> defined here
>  struct _stat
>         ^
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from c:\mingw\include\iconv.h:106,
>                  from C:/MinGW/include/libxml2/libxml/encoding.h:28,
>                  from C:/MinGW/include/libxml2/libxml/parser.h:807,
>                  from C:/MinGW/include/libxml2/libxml/globals.h:18,
>                  from C:/MinGW/include/libxml2/libxml/threads.h:35,
>                  from C:/MinGW/include/libxml2/libxml/xmlmemory.h:218,
>                  from C:/MinGW/include/libxml2/libxml/tree.h:1248,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:23:
> c:\mingw\include\sys/stat.h:180:8: error: redefinition of 'struct stat'
>  struct stat __struct_stat_defined( _off_t, time_t );
>         ^
> In file included from d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:440:0,
>                  from d:/Emacs/source/emacs-25.1/src/conf_post.h:32,
>                  from ./config.h:1916,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:89:8: note: originally 
> defined here
>  struct stat {
>         ^
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from c:\mingw\include\iconv.h:106,
>                  from C:/MinGW/include/libxml2/libxml/encoding.h:28,
>                  from C:/MinGW/include/libxml2/libxml/parser.h:807,
>                  from C:/MinGW/include/libxml2/libxml/globals.h:18,
>                  from C:/MinGW/include/libxml2/libxml/threads.h:35,
>                  from C:/MinGW/include/libxml2/libxml/xmlmemory.h:218,
>                  from C:/MinGW/include/libxml2/libxml/tree.h:1248,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:23:
> c:\mingw\include\sys/stat.h:188:8: error: redefinition of 'struct 
> _stati64'
>  struct _stati64 __struct_stat_defined( __off64_t, time_t );
>         ^
> In file included from d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:440:0,
>                  from d:/Emacs/source/emacs-25.1/src/conf_post.h:32,
>                  from ./config.h:1916,
>                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:123:8: note: originally 
> defined here
>  struct _stati64 {
>         ^
> In file included from d:/Emacs/source/emacs-25.1/src/xml.c:19:0:
> ./config.h:1836:19: error: two or more data types in declaration 
> specifiers
>  #define mbstate_t int
>                    ^
> make[1]: *** [xml.o] Error 1
> make[1]: Leaving directory `/d/Emacs/configs/25.1-MinGW-broken2/src'
> make: *** [src] Error 2
This code only runs when mbstate_t check fails. Let's look at why it fails:
> configure:18162: checking for mbstate_t
> configure:18179: gcc -I /d/Emacs/source/emacs-25.1/nt/inc -c -O0 -g3 
> -mtune=pentium4   conftest.c >&5
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from conftest.c:133:
> c:\mingw\include\sys/stat.h:173:8: error: redefinition of 'struct _stat'
>  struct _stat __struct_stat_defined( _off_t, time_t );
>         ^
> In file included from conftest.c:105:0:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:106:8: note: originally 
> defined here
>  struct _stat
>         ^
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from conftest.c:133:
> c:\mingw\include\sys/stat.h:180:8: error: redefinition of 'struct stat'
>  struct stat __struct_stat_defined( _off_t, time_t );
>         ^
> In file included from conftest.c:105:0:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:89:8: note: originally 
> defined here
>  struct stat {
>         ^
> In file included from c:\mingw\include\wchar.h:212:0,
>                  from conftest.c:133:
> c:\mingw\include\sys/stat.h:188:8: error: redefinition of 'struct 
> _stati64'
>  struct _stati64 __struct_stat_defined( __off64_t, time_t );
>         ^
> In file included from conftest.c:105:0:
> d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:123:8: note: originally 
> defined here
>  struct _stati64 {
>         ^
> configure:18179: $? = 1
Since stat.h is in mingwrt, I decided to check whether older versions 
work. And sure, mingwrt-3.21.1 works fine.

Then, there's a similar situation with glib:
> make: *** [install-strip] Error 2
>                  from 
> d:/Emacs/MinGW/include/librsvg-2.0/librsvg/rsvg.h:31,
>                  from d:/Emacs/source/emacs-25.1/src/image.c:8997:
> d:/Emacs/MinGW/include/glib-2.0/glib/gatomic.h:234:20: error: 
> redefinition of 'MemoryBarrier'
>  static inline void MemoryBarrier (void)
>                     ^
> In file included from d:\emacs\mingw\include\windef.h:269:0,
>                  from d:\emacs\mingw\include\windows.h:42,
>                  from d:/Emacs/source/emacs-25.1/src/w32gui.h:21,
>                  from d:/Emacs/source/emacs-25.1/src/dispextern.h:69,
>                  from d:/Emacs/source/emacs-25.1/src/window.h:23,
>                  from d:/Emacs/source/emacs-25.1/src/frame.h:23,
>                  from d:/Emacs/source/emacs-25.1/src/image.c:36:
> d:\emacs\mingw\include\winnt.h:4311:25: note: previous definition of 
> 'MemoryBarrier' was here
>  static FORCEINLINE void MemoryBarrier (void)
Installing w32api-3.17-2-mingw32-dev.tar.lzma helped.

-- 
Best Regards,
Nikolay Kudryavtsev






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#24613: Windows build with rsvg fails on newest MinGW
  2016-10-04 12:12 bug#24613: Windows build with rsvg fails on newest MinGW Nikolay Kudryavtsev
@ 2016-10-04 14:10 ` Eli Zaretskii
  2016-10-04 14:58   ` Nikolay Kudryavtsev
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-10-04 14:10 UTC (permalink / raw)
  To: Nikolay Kudryavtsev; +Cc: 24613

> From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
> Date: Tue, 4 Oct 2016 15:12:07 +0300
> 
> I've been trying to get rsvg working and here's what I found:

I don't see how anything in what you see is related to rsvg, what am I
missing?

> > In file included from c:\mingw\include\wchar.h:212:0,
> >                  from c:\mingw\include\iconv.h:106,
> >                  from C:/MinGW/include/libxml2/libxml/encoding.h:28,
> >                  from C:/MinGW/include/libxml2/libxml/parser.h:807,
> >                  from C:/MinGW/include/libxml2/libxml/globals.h:18,
> >                  from C:/MinGW/include/libxml2/libxml/threads.h:35,
> >                  from C:/MinGW/include/libxml2/libxml/xmlmemory.h:218,
> >                  from C:/MinGW/include/libxml2/libxml/tree.h:1248,
> >                  from d:/Emacs/source/emacs-25.1/src/xml.c:23:
> > c:\mingw\include\sys/stat.h:173:8: error: redefinition of 'struct _stat'
> >  struct _stat __struct_stat_defined( _off_t, time_t );
> >         ^
> > In file included from d:/Emacs/source/emacs-25.1/nt/inc/ms-w32.h:440:0,
> >                  from d:/Emacs/source/emacs-25.1/src/conf_post.h:32,
> >                  from ./config.h:1916,
> >                  from d:/Emacs/source/emacs-25.1/src/xml.c:19:
> > d:/Emacs/source/emacs-25.1/nt/inc/sys/stat.h:106:8: note: originally 
> > defined here
> >  struct _stat
> >         ^

So wchar.h now includes sys/stat.h?  What MinGW runtime are you using
and where did you download it?

Does it help to add the following to nt/inc/sys/stat.h?

#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#endif

The best solution in the long run is to stop redefining struct stat
and friends, and instead call it something else (since we don't use
the MS implementation of 'stat' and 'fstat' anyway).  Patches to that
effect are welcome.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#24613: Windows build with rsvg fails on newest MinGW
  2016-10-04 14:10 ` Eli Zaretskii
@ 2016-10-04 14:58   ` Nikolay Kudryavtsev
  2016-10-04 15:33     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolay Kudryavtsev @ 2016-10-04 14:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24613

> I don't see how anything in what you see is related to rsvg, what am I
> missing?
Libxml and glib are dependencies for it.

> What MinGW runtime are you using and where did you download it?

This happens with mingwrt-3.22.2-mingw32-dev.tar.xz, you can download it 
manually from MinGW sourceforge, it's also the default version you would 
get from mingw-get. Generally, building with it works, only with libxml 
fails.

> Does it help to add the following to nt/inc/sys/stat.h?
Ok, gonna try later.

> The best solution in the long run is to stop redefining struct stat
> and friends, and instead call it something else (since we don't use
> the MS implementation of 'stat' and 'fstat' anyway).
Makes sense, what about MemoryBarrier?

-- 
Best Regards,
Nikolay Kudryavtsev






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#24613: Windows build with rsvg fails on newest MinGW
  2016-10-04 14:58   ` Nikolay Kudryavtsev
@ 2016-10-04 15:33     ` Eli Zaretskii
  2016-10-06 15:13       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-10-04 15:33 UTC (permalink / raw)
  To: Nikolay Kudryavtsev; +Cc: 24613

> From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
> Cc: 24613@debbugs.gnu.org
> Date: Tue, 4 Oct 2016 17:58:50 +0300
> 
> what about MemoryBarrier?

Define away the one glib insist of giving us?  Like this:

#if __W32API_MAJOR_VERSION + (__W32API_MINOR_VERSION >= 18) >= 4
# define MemoryBarrier glib_MemoryBarrier
#endif
#include <librsvg/rsvg.h>
#undef MemoryBarrier

Does that work?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#24613: Windows build with rsvg fails on newest MinGW
  2016-10-04 15:33     ` Eli Zaretskii
@ 2016-10-06 15:13       ` Eli Zaretskii
       [not found]         ` <c7ee0766-22b4-a448-496d-4f0a9feba819@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-10-06 15:13 UTC (permalink / raw)
  To: nikolay.kudryavtsev; +Cc: 24613

> Date: Tue, 04 Oct 2016 18:33:05 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 24613@debbugs.gnu.org
> 
> > From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
> > Cc: 24613@debbugs.gnu.org
> > Date: Tue, 4 Oct 2016 17:58:50 +0300
> > 
> > what about MemoryBarrier?
> 
> Define away the one glib insist of giving us?  Like this:
> 
> #if __W32API_MAJOR_VERSION + (__W32API_MINOR_VERSION >= 18) >= 4
> # define MemoryBarrier glib_MemoryBarrier
> #endif
> #include <librsvg/rsvg.h>
> #undef MemoryBarrier
> 
> Does that work?

Never mind, I think I fixed this, on both emacs-25 and master.  Please
see if there's any fallout, or else close the bug report.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#24613: Windows build with rsvg fails on newest MinGW
       [not found]         ` <c7ee0766-22b4-a448-496d-4f0a9feba819@gmail.com>
@ 2016-10-07 12:39           ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-10-07 12:39 UTC (permalink / raw)
  To: Nikolay Kudryavtsev; +Cc: 24613

> From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
> Cc: control@debbugs.gnu.org
> Date: Fri, 7 Oct 2016 15:06:38 +0300
> 
> Tested both master and emacs-24, seems to work. Thanks for the help.

Thanks for testing.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-07 12:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-04 12:12 bug#24613: Windows build with rsvg fails on newest MinGW Nikolay Kudryavtsev
2016-10-04 14:10 ` Eli Zaretskii
2016-10-04 14:58   ` Nikolay Kudryavtsev
2016-10-04 15:33     ` Eli Zaretskii
2016-10-06 15:13       ` Eli Zaretskii
     [not found]         ` <c7ee0766-22b4-a448-496d-4f0a9feba819@gmail.com>
2016-10-07 12:39           ` Eli Zaretskii

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).