On Sat, Sep 28, 2013 at 4:36 PM, Eric Blake <eblake@redhat.com> wrote:
On 09/27/2013 01:01 PM, Jason Helfman wrote:
> On Fri, Sep 27, 2013 at 4:57 AM, Eric Blake <eblake@redhat.com> wrote:
>
>> On 09/27/2013 01:35 AM, Michal Privoznik wrote:
>>>
>>> make[3]: Entering directory
>>> `/home/zippy/work/tmp/a/libvirt-1.1.2/gnulib/lib'
>>>   CC       allocator.lo
>>> In file included from allocator.c:4:0:
>>> ./stdlib.h:76:8: error: redefinition of 'struct random_data'
>>>  struct random_data
>>>         ^
>>> In file included from ./stdlib.h:36:0,
>>>                  from allocator.c:4:
>>> /usr/include/stdlib.h:349:8: note: originally defined here
>>>  struct random_data
>>>         ^

>> Can
>> you show me the config.log output related to detecting whether 'struct
>> random_data' exists?  Is this a case of circular header inclusion on
>> FreeBSD (that is, does <sys/types.h> try to recursively include
>> <stdlib.h> to pick up the struct?)

> Should be available here:
> http://people.freebsd.org/~jgh/files/libvirt_83amd64.tar.xz

Thanks; looking through that, I see:

configure:31404: checking for struct random_data
configure:31404: cc -std=gnu99 -c -O2 -pipe -fno-strict-aliasing
-D_THREAD_SAFE -D_THREAD_SAFE conftest.c >&5
conftest.c: In function 'main':
conftest.c:346: error: invalid application of 'sizeof' to incomplete
type 'struct random_data'
...

| #include <stdlib.h>
|       #if HAVE_RANDOM_H
|       # include <random.h>
|       #endif
|
|
| int
| main ()
| {
| if (sizeof (struct random_data))

So, what has to be included prior to <stdlib.h> for the forward
declaration of struct random_data in that header to no longer be an
incomplete type?  Can you grep your system headers and find what all
mentions struct random_data?


In looking through our 8.4 Branch, here are the results of digging the tree:

crypto/openssh/pkcs11.h:                       unsigned char *random_data,
crypto/heimdal/lib/hx509/ref/pkcs11.h:                 unsigned char *random_data,
crypto/heimdal/lib/hx509/hxtool.c:random_data(void *opt, int argc, char **argv)
sys/netinet/sctp_output.c:              SCTP_READ_RANDOM(randp->random_data, random_len);
sys/netinet/sctp_header.h:      uint8_t random_data[];

Per another developer at FreeBSD, it seems to be a bug in 8.x branch and picking up something it shouldn't and was "fixed" by adding this to the configure environment:
ac_cv_type_struct_random_data=""

http://redports.org/~jgh/20130930154500-61365-148605/libvirt-1.1.2.log

However the build still fails, but looks to be a more standard failure. Any more ideas on this?

-jgh


--
Jason Helfman          | FreeBSD Committer
jgh@FreeBSD.org     | http://people.freebsd.org/~jgh  | The Power to Serve