bug-gzip
[Top][All Lists]
Advanced

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

Re: [Daniel Schepler] Bug#653960: gzip: FTBFS: conflicting types for 'rp


From: Eric Blake
Subject: Re: [Daniel Schepler] Bug#653960: gzip: FTBFS: conflicting types for 'rpl_fstat' (in win32 build)
Date: Mon, 05 Mar 2012 14:15:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

On 03/05/2012 02:13 PM, Eric Blake wrote:
> On 03/05/2012 01:21 PM, Bdale Garbee wrote:
>> Is there a fix or workaround for this error when cross-compiling gzip
>> with i686-w64-mingw32-gcc?  We build such an executable in the Debian
>> package build to support the debian-installer team.  A quick scan
>> through the gzip and gnulib git repositories didn't point to anything
>> obvious.
> 
> Yes - the fix is to upgrade to newer gnulib.

[hit send too soon]

In particular, gnulib commit 253e7e986 fixes the problem for the mingw64
compiler.

It may be possible to backport just that patch to lib/sys_stat.in.h on
the gzip tarball, while you wait for a new gzip release that officially
pulls in newer gnulib sources:

commit 253e7e986ecff5d39654a22259b4e5018d71643b
Author: Bruno Haible <address@hidden>
Date:   Mon Jan 30 21:43:40 2012 +0100

    sys_stat: Fix support for mingw64 and MSVC.

    * lib/sys_stat.in.h (stat) [AIX]: Don't redefine 'stat' if the system
    header files already do it.
    (stat) [mingw, msvc]: Redefine the symbol to which stat is defined, not
    stat itself.
    Reported by Marc-André Lureau <address@hidden>.

diff --git a/ChangeLog b/ChangeLog
index d387408..2f5e234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-01-29  Bruno Haible  <address@hidden>

+       sys_stat: Fix support for mingw64 and MSVC.
+       * lib/sys_stat.in.h (stat) [AIX]: Don't redefine 'stat' if the system
+       header files already do it.
+       (stat) [mingw, msvc]: Redefine the symbol to which stat is defined, not
+       stat itself.
+       Reported by Marc-André Lureau <address@hidden>.
+
+2012-01-29  Bruno Haible  <address@hidden>
+
        wcwidth: Work around bug in UTF-8 locale on OpenBSD 5.0.
        * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Test also wcwidth of U+05B0.
        * doc/posix-functions/wcwidth.texi: Mention the OpenBSD 5.0 bug.
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 005ad2d..36c4189 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -616,14 +616,33 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 /* We can't use the object-like #define stat rpl_stat, because of
    struct stat.  This means that rpl_stat will not be used if the user
    does (stat)(a,b).  Oh well.  */
-#  undef stat
-#  ifdef _LARGE_FILES
+#  if defined _AIX && defined stat && defined _LARGE_FILES
     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
        so we have to replace stat64() instead of stat(). */
-#   define stat stat64
 #   undef stat64
 #   define stat64(name, st) rpl_stat (name, st)
-#  else /* !_LARGE_FILES */
+#  elif defined __MINGW32__ && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32i64.  */
+#    undef _stat32i64
+#    define _stat32i64(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64.  */
+#    undef _stat64
+#    define _stat64(name, st) rpl_stat (name, st)
+#   endif
+#  elif defined _MSC_VER && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32.  */
+#    undef _stat32
+#    define _stat32(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64i32.  */
+#    undef _stat64i32
+#    define _stat64i32(name, st) rpl_stat (name, st)
+#   endif
+#  else /* !(_AIX ||__MINGW32__ ||  _MSC_VER) */
+#   undef stat
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
 _GL_EXTERN_C int stat (const char *name, struct stat *buf)


-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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