[libvirt] Libvirt / GNULIB failures using Mingw64 toolchain

Bruno Haible bruno at clisp.org
Thu Jun 21 10:42:17 UTC 2012


Daniel P. Berrange wrote:
> Here's what i see in config.status for my libvirt build:
> 
> $ grep -i vscanf config.status
> S["GNULIB_VSCANF"]="0"
> 
> $ grep STDIO config.status
> S["NEXT_AS_FIRST_DIRECTIVE_STDIO_H"]="<stdio.h>"
> S["NEXT_STDIO_H"]="<stdio.h>"
> S["REPLACE_STDIO_WRITE_FUNCS"]="1"
> S["REPLACE_STDIO_READ_FUNCS"]="1"
> S["GNULIB_STDIO_H_SIGPIPE"]="1"
> S["GNULIB_STDIO_H_NONBLOCKING"]="1"

Thanks for these details. The attached patch looks like it should fix the
compilation error. I'm committing it. Can you please try it (you need to
re-bootstrap libvirt to this effect, I guess)?


2012-06-21  Bruno Haible  <bruno at clisp.org>

	nonblocking: Avoid compilation error on mingw64.
	* m4/stdio_h.m4 (gl_STDIO_H): Invoke gl_MODULE_INDICATOR for scanf,
	fscanf.
	* modules/vscanf (configure.ac): Invoke gl_MODULE_INDICATOR.
	* modules/vfscanf (configure.ac): Likewise.
	* lib/stdio-read.c (scanf, fscanf, vscanf, vfscanf): Enable function
	definition only if stdio.h has prepared it.
	Reported by Daniel P. Berrange <berrange at redhat.com>.

--- lib/stdio-read.c.orig	Thu Jun 21 12:35:50 2012
+++ lib/stdio-read.c	Thu Jun 21 12:35:21 2012
@@ -72,6 +72,9 @@
       return ret;                                                             \
     }
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_SCANF
 int
 scanf (const char *format, ...)
 {
@@ -84,7 +87,11 @@
 
   return retval;
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_FSCANF
 int
 fscanf (FILE *stream, const char *format, ...)
 {
@@ -97,19 +104,28 @@
 
   return retval;
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VSCANF
 int
 vscanf (const char *format, va_list args)
 {
   return vfscanf (stdin, format, args);
 }
+#  endif
 
+/* Enable this function definition only of gnulib's <stdio.h> has prepared it.
+   Otherwise we get a function definition conflict with mingw64's <stdio.h>.  */
+#  if GNULIB_VFSCANF
 int
 vfscanf (FILE *stream, const char *format, va_list args)
 #undef vfscanf
 {
   CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF)
 }
+#  endif
 
 int
 getchar (void)
--- m4/stdio_h.m4.orig	Thu Jun 21 12:35:50 2012
+++ m4/stdio_h.m4	Thu Jun 21 12:30:28 2012
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 41
+# stdio_h.m4 serial 42
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,9 @@
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   GNULIB_FSCANF=1
+  gl_MODULE_INDICATOR([fscanf])
   GNULIB_SCANF=1
+  gl_MODULE_INDICATOR([scanf])
   GNULIB_FGETC=1
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
--- modules/vfscanf.orig	Thu Jun 21 12:35:50 2012
+++ modules/vfscanf	Thu Jun 21 12:30:24 2012
@@ -8,6 +8,7 @@
 
 configure.ac:
 gl_STDIO_MODULE_INDICATOR([vfscanf])
+gl_MODULE_INDICATOR([vfscanf])
 
 Makefile.am:
 
--- modules/vscanf.orig	Thu Jun 21 12:35:50 2012
+++ modules/vscanf	Thu Jun 21 12:30:24 2012
@@ -8,6 +8,7 @@
 
 configure.ac:
 gl_STDIO_MODULE_INDICATOR([vscanf])
+gl_MODULE_INDICATOR([vscanf])
 
 Makefile.am:
 




More information about the libvir-list mailing list