Skip to contentSkip to conversation

CMSG_SPACE() causing compile time error on Mac OS X

Qemu-devel Programmingkid 5 participants 15 messages Jan 17, 2016 – Jan 19, 2016

lore
Share & tools
lore
#0 lore raw

I was wondering if you had problems compiling QEMU on Mac OS X recently. On my system, the channel-socket.c file causes this error:

io/channel-socket.c: In function 'qio_channel_socket_writev':
io/channel-socket.c:497:18: error: variable-sized object may not be initialized

     char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };

As a test I made this simple program:

#include <sys/socket.h>
#include <stdio.h>

int main (int argc, char * const argv[]) {

    printf("GCC version = %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
    char control[CMSG_SPACE(sizeof(int) * 16)] = { 0 };
    control[0] = 'a';  // just to eliminate a warning
    return 0;
}

When compiling under Xcode, the program does compile and run. It prints "GCC version = 4.2.1".

When I try to compile it under gcc 4.2.1 using just the terminal, I see this error message:
main.cpp: In function ‘int main(int, char* const*)’:
main.cpp:6: error: size of array ‘control’ is not an integral constant-expression

Why there is a difference between XCode and the terminal I have no idea.

When compiling it under gcc 4.9.2, it compiles and runs without problem.

I have set the configure option for cc to gcc-4.9 with this "-cc=gcc-4.9". So the error message makes me believe that the wrong compiler is being used.

This is the full configure command options I used:
./configure --cxx=gcc-4.9 --cc=gcc-4.9 --objcc=gcc-4.9 --disable-gtk --disable-sdl --target-list=ppc-softmmu,i386-softmmu

Any insight as to what could be wrong?

#1 lore raw
Quoted 8 lines · Programmingkid

When compiling under Xcode, the program does compile and run. It prints "GCC version = 4.2.1".

When I try to compile it under gcc 4.2.1 using just the terminal, I see this error message:
main.cpp: In function ‘int main(int, char* const*)’:
main.cpp:6: error: size of array ‘control’ is not an integral constant-expression

Why there is a difference between XCode and the terminal I have no idea.

Quoted 8 lines

When compiling it under gcc 4.9.2, it compiles and runs without problem.

I have set the configure option for cc to gcc-4.9 with this "-cc=gcc-4.9". So the error message makes me believe that the wrong compiler is being used.

This is the full configure command options I used:
./configure --cxx=gcc-4.9 --cc=gcc-4.9 --objcc=gcc-4.9 --disable-gtk --disable-sdl --target-list=ppc-softmmu,i386-softmmu

Any insight as to what could be wrong?

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

#2 lore raw
Quoted 15 lines · Paolo Bonzini
Quoted 12 lines · Programmingkid

When compiling under Xcode, the program does compile and run. It prints "GCC version = 4.2.1".

When I try to compile it under gcc 4.2.1 using just the terminal, I see this error message:
main.cpp: In function ‘int main(int, char* const*)’:
main.cpp:6: error: size of array ‘control’ is not an integral constant-expression

Why there is a difference between XCode and the terminal I have no idea.

When compiling it under gcc 4.9.2, it compiles and runs without problem.

I have set the configure option for cc to gcc-4.9 with this "-cc=gcc-4.9". So the error message makes me believe that the wrong compiler is being used.

Quoted 8 lines
Quoted 4 lines

This is the full configure command options I used:
./configure --cxx=gcc-4.9 --cc=gcc-4.9 --objcc=gcc-4.9 --disable-gtk --disable-sdl --target-list=ppc-softmmu,i386-softmmu

Any insight as to what could be wrong?

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))

Hope this helps.

#3 lore raw
Quoted 5 lines · Programmingkid
Quoted 3 lines

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))

And the definition of __DARWIN_ALIGN32()?

It looks like the definition is not properly resulting in a compile-time constant, and therefore the warning about the initializer is resulting because you can't initialize a dynamically-sized array. But you still haven't shown us why the headers are resulting in a non-constant size.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#4 lore raw
Quoted 5 lines · Eric Blake
Quoted 4 lines · Programmingkid
Quoted 3 lines

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

Quoted 8 lines
Quoted 1 line

#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))

And the definition of __DARWIN_ALIGN32()?

It looks like the definition is not properly resulting in a compile-time constant, and therefore the warning about the initializer is resulting because you can't initialize a dynamically-sized array. But you still haven't shown us why the headers are resulting in a non-constant size.

FWIW, on my OSX system (OSX 10.10.5, Xcode 7.1), compiling the test program with

gcc -Wall -E -o /tmp/varray.S /tmp/varray.c

shows that the array definition expands to

    char control[(((__darwin_size_t)((char

*)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

the relevant macro definitions being
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char
*)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)

this is with a 'gcc' that gcc --version reports as Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

and which claims itself to be 4.2.1 by the printout from the test program (ie it's clang under the hood).

I don't get any compiler warnings from
gcc -Wall -O2 -o /tmp/varray /tmp/varray.c

I don't know what the difference between my setup and John's is (likely an older clang version).

thanks
-- PMM

#5 lore raw
Quoted 43 lines · Peter Maydell
Quoted 5 lines · Eric Blake
Quoted 4 lines · Programmingkid
Quoted 3 lines

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

Quoted 8 lines
Quoted 1 line

#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))

And the definition of __DARWIN_ALIGN32()?

It looks like the definition is not properly resulting in a compile-time constant, and therefore the warning about the initializer is resulting because you can't initialize a dynamically-sized array. But you still haven't shown us why the headers are resulting in a non-constant size.

FWIW, on my OSX system (OSX 10.10.5, Xcode 7.1), compiling the test program with

gcc -Wall -E -o /tmp/varray.S /tmp/varray.c

shows that the array definition expands to

   char control[(((__darwin_size_t)((char

*)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

the relevant macro definitions being
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char
*)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)

this is with a 'gcc' that gcc --version reports as Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Quoted 2 lines

and which claims itself to be 4.2.1 by the printout from the test program (ie it's clang under the hood).

That is interesting. I would have thought Apple would have upgrade their GCC compatibility version by now.

Quoted 9 lines

I don't get any compiler warnings from
gcc -Wall -O2 -o /tmp/varray /tmp/varray.c

I don't know what the difference between my setup and John's is (likely an older clang version).

thanks
-- PMM

A patch by Daniel P. Berrange successfully fixes this problem.

http://patchwork.ozlabs.org/patch/569500/

io/channel-socket.c +1 -1
index eaa411f..bc117b1 100644
@@ -493,10 +495,12 @@  static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
 
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
     ssize_t ret;
     struct msghdr msg = { NULL, };
 
-    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
+    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
 
     size_t fdsize = sizeof(int) * nfds;
     struct cmsghdr *cmsg;
 

+ memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS));
+

     msg.msg_iov = (struct iovec *)iov;
     msg.msg_iovlen = niov;
#6 lore raw
In reply to Eric Blake
Quoted 5 lines · Eric Blake
Quoted 4 lines · Programmingkid
Quoted 3 lines

What's the definition of the CMSG_SPACE macro under OS X?

Paolo

Quoted 8 lines
Quoted 1 line

#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))

And the definition of __DARWIN_ALIGN32()?

It looks like the definition is not properly resulting in a compile-time constant, and therefore the warning about the initializer is resulting because you can't initialize a dynamically-sized array. But you still haven't shown us why the headers are resulting in a non-constant size.

I tried what Peter Maydell did and here are the results:

typedef __darwin_size_t size_t;

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

It looks like the problem was actually with this part: = { 0 };

#7 lore raw
Quoted 7 lines · Programmingkid

I tried what Peter Maydell did and here are the results:

typedef __darwin_size_t size_t;

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

It looks like the problem was actually with this part: = { 0 };

No, the problem is that the compiler seems to think the bit in [] is not compile time constant (the = { 0 } initializer syntax is valid if and only if it is compile-time-constant).

Can you say what 'gcc --version' prints for you? That will tell us the clang version number, which is more interesting than what clang claims its gcc-compatibility is.

I'm leaning towards this being a compiler bug fixed in a later version of clang, because that [] expression looks like it should be constant to me, and it's constant as far as my clang version thinks.

thanks
-- PMM

#8 lore raw
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Programmingkid

I tried what Peter Maydell did and here are the results:

typedef __darwin_size_t size_t;

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

It looks like the problem was actually with this part: = { 0 };

Quoted 7 lines

No, the problem is that the compiler seems to think the bit in [] is not compile time constant (the = { 0 } initializer syntax is valid if and only if it is compile-time-constant).

Can you say what 'gcc --version' prints for you? That will tell us the clang version number, which is more interesting than what clang claims its gcc-compatibility is.

$ gcc-4.9 --version
gcc-4.9 (Homebrew gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Quoted 4 lines

I'm leaning towards this being a compiler bug fixed in a later version of clang, because that [] expression looks like it should be constant to me, and it's constant as far as my clang version thinks.

A bug could be the case. I use gcc 4.9.2 to compile QEMU. I don't use the clang compiler.

Just in case here is the info from Apple's clang compiler on my system:

$ gcc --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#9 lore raw
Quoted 11 lines · Programmingkid
Quoted 3 lines · Peter Maydell

Can you say what 'gcc --version' prints for you? That will tell us the clang version number, which is more interesting than what clang claims its gcc-compatibility is.

$ gcc-4.9 --version
gcc-4.9 (Homebrew gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ah, I misread your earlier message and I thought you said that gcc-4.9 worked ok and it was plain 'gcc' that caused the warning. Is that expansion of the macro the one produced by gcc-4.9, then?

Also, you're right that we should figure out why it seems to be using the wrong C compiler. Can you use 'V=1' to look at what command line make is using to compile this file, please? (you'll probably want to dump the whole make output to a file and then search through it). Also:
* what does your config-host.mak say (in particular about what it's set CC, HOST_CC, CXX, etc to)?
* can you check your environment doesn't have CC set to anything? ("env | grep CC" should tell you if it is)

thanks
-- PMM

#10 lore raw
Quoted 13 lines · Peter Maydell
Quoted 11 lines · Programmingkid
Quoted 3 lines · Peter Maydell

Can you say what 'gcc --version' prints for you? That will tell us the clang version number, which is more interesting than what clang claims its gcc-compatibility is.

$ gcc-4.9 --version
gcc-4.9 (Homebrew gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Quoted 3 lines

Ah, I misread your earlier message and I thought you said that gcc-4.9 worked ok and it was plain 'gcc' that caused the warning. Is that expansion of the macro the one produced by gcc-4.9, then?

Actually it should have but wasn't. It is of gcc 4.2.1.

Here is gcc 4.9.2's output:

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

This is gcc 4.2.1's output:

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

They appear to be identical.

Quoted 6 lines

Also, you're right that we should figure out why it seems to be using the wrong C compiler. Can you use 'V=1' to look at what command line make is using to compile this file, please? (you'll probably want to dump the whole make output to a file and then search through it).

It says gcc-4.9 for the compiler. I wonder if the wrong header file is being used somewhere.

Quoted 3 lines

Also:
* what does your config-host.mak say (in particular about what it's set CC, HOST_CC, CXX, etc to)?

CC=gcc-4.9
HOST_CC=cc
CXX=gcc-4.9
CPP=gcc-4.9 -E
OBJCC=gcc-4.9

Quoted 2 lines

* can you check your environment doesn't have CC set to anything? ("env | grep CC" should tell you if it is)

Nothing is returned.

#11 lore raw
Quoted 51 lines · Programmingkid
Quoted 13 lines · Peter Maydell
Quoted 11 lines · Programmingkid
Quoted 3 lines · Peter Maydell

Can you say what 'gcc --version' prints for you? That will tell us the clang version number, which is more interesting than what clang claims its gcc-compatibility is.

$ gcc-4.9 --version
gcc-4.9 (Homebrew gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Quoted 3 lines

Ah, I misread your earlier message and I thought you said that gcc-4.9 worked ok and it was plain 'gcc' that caused the warning. Is that expansion of the macro the one produced by gcc-4.9, then?

Actually it should have but wasn't. It is of gcc 4.2.1.

Here is gcc 4.9.2's output:

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

This is gcc 4.2.1's output:

char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };

They appear to be identical.

Quoted 6 lines

Also, you're right that we should figure out why it seems to be using the wrong C compiler. Can you use 'V=1' to look at what command line make is using to compile this file, please? (you'll probably want to dump the whole make output to a file and then search through it).

It says gcc-4.9 for the compiler. I wonder if the wrong header file is being used somewhere.

Quoted 3 lines

Also:
* what does your config-host.mak say (in particular about what it's set CC, HOST_CC, CXX, etc to)?

CC=gcc-4.9
HOST_CC=cc
CXX=gcc-4.9
CPP=gcc-4.9 -E
OBJCC=gcc-4.9

Quoted 4 lines
Quoted 2 lines

* can you check your environment doesn't have CC set to anything? ("env | grep CC" should tell you if it is)

Nothing is returned.

printf("GCC version = %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);

I thought I should add that with this code in the qio_channel_socket_register_types() function of channel-socket.c, this was printed: GCC version = 4.9.2

It looks like my theory of another version of GCC being used for compiling the channel-socket.c file isn't correct.

#12 lore raw
In reply to Programmingkid
Quoted 5 lines · Programmingkid

I was wondering if you had problems compiling QEMU on Mac OS X recently. On my system, the channel-socket.c file causes this error:

io/channel-socket.c: In function 'qio_channel_socket_writev':
io/channel-socket.c:497:18: error: variable-sized object may not be initialized

     char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };

Can you try applying this patch:

io/channel-socket.c +3 -1
index eaa411f..bc117b1 100644
@@ -493,10 +495,12 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
     ssize_t ret;
     struct msghdr msg = { NULL, };
-    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
+    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
     size_t fdsize = sizeof(int) * nfds;
     struct cmsghdr *cmsg;
 
+    memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS));
+
     msg.msg_iov = (struct iovec *)iov;
     msg.msg_iovlen = niov;
 

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
author Reviewed-by
#13 lore raw
Quoted 29 lines · Daniel P. Berrange
Quoted 5 lines · Programmingkid

I was wondering if you had problems compiling QEMU on Mac OS X recently. On my system, the channel-socket.c file causes this error:

io/channel-socket.c: In function 'qio_channel_socket_writev':
io/channel-socket.c:497:18: error: variable-sized object may not be initialized

    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };

Can you try applying this patch:

io/channel-socket.c +3 -1
index eaa411f..bc117b1 100644
@@ -493,10 +495,12 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
    QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
    ssize_t ret;
    struct msghdr msg = { NULL, };
-    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
+    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
    size_t fdsize = sizeof(int) * nfds;
    struct cmsghdr *cmsg;
 
+    memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS));
+
    msg.msg_iov = (struct iovec *)iov;
    msg.msg_iovlen = niov;
 
Quoted 7 lines

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

Your patch solves the problem. Good job!

#14 lore raw
Quoted 33 lines · Programmingkid
Quoted 17 lines · Daniel P. Berrange
Quoted 5 lines · Programmingkid

I was wondering if you had problems compiling QEMU on Mac OS X recently. On my system, the channel-socket.c file causes this error:

io/channel-socket.c: In function 'qio_channel_socket_writev':
io/channel-socket.c:497:18: error: variable-sized object may not be initialized

    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };

Can you try applying this patch:

io/channel-socket.c +0 -0
index eaa411f..bc117b1 100644
@@ -493,10 +495,12 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
    QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
    ssize_t ret;
    struct msghdr msg = { NULL, };

io/channel-socket.c static ssize_t qio_channel_socket_writev(QIOChannel *ioc, · line 506

Quoted 10 lines
io/channel-socket.c +3 -1
-    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
+    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
    size_t fdsize = sizeof(int) * nfds;
    struct cmsghdr *cmsg;
 
+    memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS));
+
    msg.msg_iov = (struct iovec *)iov;
    msg.msg_iovlen = niov;
 

Your patch solves the problem. Good job!

Quoted 1 line

Thanks, I'll include this fix in my next PULL request for the io/ layer

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|