bug-gnulib
[Top][All Lists]
Advanced

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

Re: getopt broken when building with glibc 2.25.90


From: Daniel P. Berrange
Subject: Re: getopt broken when building with glibc 2.25.90
Date: Mon, 5 Jun 2017 10:49:16 +0100
User-agent: Mutt/1.8.0 (2017-02-23)

On Fri, Jun 02, 2017 at 11:18:04AM -0700, Paul Eggert wrote:
> On 06/02/2017 09:25 AM, Daniel P. Berrange wrote:
> > Fedora rawhide is now shipping with glibc 2.25.90 and when trying to
> > build libvirt with gnulib's getopt module, it crashes & burns
> > 
> >    CC       getopt.lo
> > In file included from ./getopt.h:57:0,
> >                   from ../../../gnulib/lib/getopt.c:26:
> > ../../config.h:2934:25: warning: 'struct rpl_option' declared inside 
> > parameter list will not be visible outside of this definition or declaration
> >   #define __GETOPT_PREFIX rpl_
> >                           ^
> > ../../../gnulib/lib/getopt_pfx_core.h:38:44: note: in expansion of macro 
> > '__GETOPT_PREFIX'
> >   #  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
> 
> There is no file getopt_pfx_core.h in current Gnulib, so it sounds like you
> have some sort of mixture of old and new Gnulib imported into libvirt's
> source directory.  suggest ripping out all the old stuff and importing the
> latest Gnulib version.

Sorry, these error messages from the point at which I had git bisected the
failure, down to e7207fdf6ac20e8228d99248a73816f99ba8ce78, which is just
before you renamed all the files to use '-' instead of "_". You get the
same compile failure with very latest gnulib. The problem is the header
file conditionals are clashing with system headers, and is fixed by this
patch:

>From f574a594b70d1111590949f8ac82d4bc10bc13c6 Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <address@hidden>
Date: Mon, 5 Jun 2017 10:41:05 +0100
Subject: [PATCH] getopt: avoid header conditional clash with system headers

The getopt-core.h and getopt-ext.h files are synchronized with
the same files present in glibc. This means they also share the
same "#ifndef _GETOPT_*_H" conditional protection. While the
gnulib header and the glibc header contain the same definitions,
the functional effect of including them is different, because
gnulib arranges for a 'rpl_' prefix to be added to every symbol
in the header.

When compiling gnulib against glibc >= 2.25.90, the system
copy of getopt-core.h and getopt-ext.h will be pulled in first,
via the "#include_next <getopt.h>" statement. When gnulib tries
to include its local getopt-core.h & getopt-ext.h, while applying
symbol renaming, the '#ifndef _GETOPT_*_H' protection causes
the include to be a no-op. Thus when compiling getopt.c, all
of the getopt symbols with a 'rpl_' prefix are missing.

Signed-off-by: Daniel P. Berrange <address@hidden>
---
 lib/getopt-core.h | 6 +++---
 lib/getopt-ext.h  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/getopt-core.h b/lib/getopt-core.h
index 8c9eb51..cab3412 100644
--- a/lib/getopt-core.h
+++ b/lib/getopt-core.h
@@ -17,8 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _GETOPT_CORE_H
-#define _GETOPT_CORE_H 1
+#ifndef _GL_GETOPT_CORE_H
+#define _GL_GETOPT_CORE_H 1
 
 /* This header should not be used directly; include getopt.h or
    unistd.h instead.  Unlike most bits headers, it does not have
@@ -93,4 +93,4 @@ extern int getopt (int ___argc, char *const *___argv, const 
char *__shortopts)
 
 __END_DECLS
 
-#endif /* _GETOPT_CORE_H */
+#endif /* _GL_GETOPT_CORE_H */
diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h
index 94190df..0ded089 100644
--- a/lib/getopt-ext.h
+++ b/lib/getopt-ext.h
@@ -17,8 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _GETOPT_EXT_H
-#define _GETOPT_EXT_H 1
+#ifndef _GL_GETOPT_EXT_H
+#define _GL_GETOPT_EXT_H 1
 
 /* This header should not be used directly; include getopt.h instead.
    Unlike most bits headers, it does not have a protective #error,
@@ -74,4 +74,4 @@ extern int getopt_long_only (int ___argc, char 
*__getopt_argv_const *___argv,
 
 __END_DECLS
 
-#endif /* _GETOPT_EXT_H */
+#endif /* _GL_GETOPT_EXT_H */
-- 
2.9.3




Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



reply via email to

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