[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error: redefinition of `struct random_data'
From: |
Bruno Haible |
Subject: |
Re: error: redefinition of `struct random_data' |
Date: |
Tue, 12 Oct 2010 00:41:33 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Sam,
> I am getting this error
> when compiling gllib in the regexp clisp module on mingw and cygwin:
> gcc -mno-cygwin -DHAVE_CONFIG_H -I. -I/.../current/modules/regexp/gllib -I..
> -I/.../top/include -I/.../current/build-mingw-g-7/gllib
> -I/.../current/build-mingw-g-7 -g -O2 -W -Wswitch -Wcomment -Wpointer-arith
> -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare
> -Wno-format-nonliteral -falign-functions=4 -D_WIN32 -g -O0 -DDEBUG_OS_ERROR
> -DDEBUG_SPVW -DDEBUG_BYTECODE -DSAFETY=3 -DENABLE_UNICODE
> -DNO_TERMCAP_NCURSES
> -DDYNAMIC_FFI -DDYNAMIC_MODULES -DNO_GETTEXT -I. -DDLL_EXPORT -DPIC
> -I/.../current/build-mingw-g-7/ -MT malloc.o -MD -MP -MF .deps/malloc.Tpo -c
> -o malloc.o /.../current/modules/regexp/gllib/malloc.c
> In file included from /.../current/modules/regexp/gllib/malloc.c:
> 32:./stdlib.h:65: error: redefinition of `struct random_data'
> make[4]: *** [malloc.o] Error 1
>
> indeed, I have stdlib.h both in gllib and regexp/gllib.
It sounds like you have two invocations for gnulib-tool, one for gllib,
and one for regexp/gllib. During the configurations, it was determined that
the system's <stdlib.h> does not define 'struct random_data', so it is
gnulib's task to define it. So both generated stdlib.h files now define
'struct random_data'. Now, in your compilation the -I options refer to
both directories where they exist, hence the #include_next statements
chain the two files. You probably renamed the inclusion guard (_GL_STDLIB_H)
appropriate (as recommended). And now the two structure definitions clash.
There are two ways out:
a) gnulib should add another guard so as to ensure that 'struct random_data'
does not get defined twice.
b) You use the gnulib-tool option --avoid-stdlib in regexp/gllib.
I think the problem you encountered is not specific to clisp, therefore I'm
applying approach a).
2010-10-11 Bruno Haible <address@hidden>
stdlib: Allow multiple gnulib generated replacements to coexist.
* lib/stdlib.in.h (struct random_data): Avoid identical redefinition.
Reported by Sam Steingold <address@hidden>.
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -61,6 +61,9 @@
#endif
#if address@hidden@
+/* Define 'struct random_data'.
+ But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
+# if !GNULIB_defined_struct_random_data
struct random_data
{
int32_t *fptr; /* Front pointer. */
@@ -71,6 +74,8 @@ struct random_data
int rand_sep; /* Distance between front and rear. */
int32_t *end_ptr; /* Pointer behind state table. */
};
+# define GNULIB_defined_struct_random_data 1
+# endif
#endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && !
defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined
__CYGWIN__)
- error: redefinition of `struct random_data', Sam Steingold, 2010/10/11
- Re: error: redefinition of `struct random_data',
Bruno Haible <=
- Re: error: redefinition of `struct random_data', Sam Steingold, 2010/10/11
- Re: double inclusion guard, Bruno Haible, 2010/10/11
- Re: double inclusion guard, Gary V. Vaughan, 2010/10/11
- Re: double inclusion guard, Eric Blake, 2010/10/11
- Re: double inclusion guard, Gary V. Vaughan, 2010/10/11
- Re: double inclusion guard, Bruce Korb, 2010/10/12
- Re: double inclusion guard, Bruno Haible, 2010/10/12
- Re: double inclusion guard, Bruno Haible, 2010/10/12
- Re: double inclusion guard, Gary V. Vaughan, 2010/10/13
- Re: double inclusion guard, Gary V. Vaughan, 2010/10/12