bug-gnulib
[Top][All Lists]
Advanced

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

Re: ./getopt.h:195: error: redefinition of 'struct option'


From: Richard W.M. Jones
Subject: Re: ./getopt.h:195: error: redefinition of 'struct option'
Date: Fri, 4 Jun 2010 13:46:13 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Jun 04, 2010 at 02:17:22PM +0200, Bruno Haible wrote:
> Hi Richard,
> 
> Last time we saw this error message, it was due to a wrong config.h.

The results below are after 'rm config.h; ./configure ...; make clean'

> Richard W.M. Jones wrote:
> > make[4]: Entering directory `/home/rjones/d/libguestfs/gnulib/lib'
> >   CC     xstrtol.lo
> 
> Can you show the complete command line? ("make V=1" will show it.)

make[4]: Entering directory `/home/rjones/d/libguestfs/gnulib/lib'
depbase=`echo xstrtol.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
        /bin/sh ../../libtool  --tag=CC   --mode=compile gcc -std=gnu99 
-std=gnu99 -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT xstrtol.lo -MD -MP -MF 
$depbase.Tpo -c -o xstrtol.lo xstrtol.c &&\
        mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -g -O2 
-MT xstrtol.lo -MD -MP -MF .deps/xstrtol.Tpo -c xstrtol.c  -fPIC -DPIC -o 
.libs/xstrtol.o
In file included from xstrtol.h:23,
                 from xstrtol.c:32:
./getopt.h:195: error: redefinition of 'struct option'
[...]

> > In file included from xstrtol.h:23,
> >                  from xstrtol.c:32:
> > ./getopt.h:195: error: redefinition of 'struct option'
> 
> Next, you need to show
>   1)   grep GETOPT config.status

$ grep GETOPT config.status 
S["GETOPT_H"]=""
S["HAVE_GETOPT_H"]="1"
S["NEXT_AS_FIRST_DIRECTIVE_GETOPT_H"]="<getopt.h>"
S["NEXT_GETOPT_H"]="<getopt.h>"
S["GNULIB_UNISTD_H_GETOPT"]="0"
D["HAVE_GETOPT_H"]=" 1"
D["HAVE_GETOPT_H"]=" 1"
D["HAVE_GETOPT_LONG_ONLY"]=" 1"
D["HAVE_DECL_GETOPT_CLIP"]=" 0"
D["GNULIB_TEST_GETOPT_GNU"]=" 1"

>   2)   the contents of config.h

Attached.

>   3)   if the first two don't help, also the output of the
>        complete command line, without -c and -o options, but with -E and -dD
>        options instead.

gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT xstrtol.lo -MD 
-MP -MF .deps/xstrtol.Tpo -dD -E xstrtol.c  -fPIC -DPIC > xstrtol-preproc.i

http://www.annexia.org/tmp/xstrtol-preproc.i

This shows:

# 175 "/usr/include/getopt.h" 3 4
extern int getopt_long (int ___argc, char *const *___argv,
   const char *__shortopts,
          const struct option *__longopts, int *__longind)
       __attribute__ ((__nothrow__));
[...]
extern int getopt_long (int ___argc, char *const *___argv,
                        const char *__shortopts,
                        const struct option *__longopts, int *__longind)
       __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));

So the difference does seem to be down to the extra _GL_ARG_NONNULL
attribute.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html

Attachment: config.h
Description: Text document


reply via email to

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