[PATCH] remote: Make remote_daemon depend on qemu_protocol.h

He Zhe posted 1 patch 1 year, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220720084120.14207-1-zhe.he@windriver.com
src/remote/meson.build | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
[PATCH] remote: Make remote_daemon depend on qemu_protocol.h
Posted by He Zhe 1 year, 8 months ago
We sometimes meet the following parallel compililation issue, since
remote_daemon depends on remote_protocol.h qemu_protocol.h and lxc_protocol.h,
which are usually generated due to remote_driver .

| FAILED: src/virtnetworkd.p/remote_remote_daemon_dispatch.c.o
| x86_64-wrs-linux-gcc ...
| In file included from ../libvirt-8.1.0/src/remote/remote_daemon_dispatch.c:26:
| ../libvirt-8.1.0/src/remote/remote_daemon.h:30:10: fatal error: qemu_protocol.h: No such file or directory
|    30 | #include "qemu_protocol.h"
|       |          ^~~~~~~~~~~~~~~~~
| compilation terminated.

This patch adds the headers as dependencies of remote_daemon to make sure they
are always in place in advance.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 src/remote/meson.build | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/remote/meson.build b/src/remote/meson.build
index eb4f7a0068..04525fb4a6 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -5,6 +5,15 @@ remote_driver_sources = [
 
 remote_driver_generated = []
 
+remote_daemon_sources = files(
+  'remote_daemon.c',
+  'remote_daemon_config.c',
+  'remote_daemon_dispatch.c',
+  'remote_daemon_stream.c',
+)
+
+remote_daemon_generated = []
+
 foreach name : [ 'remote', 'qemu', 'lxc' ]
   client_bodies_h = '@0@_client_bodies.h'.format(name)
   protocol_c = '@0@_protocol.c'.format(name)
@@ -21,7 +30,7 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
     capture: true,
   )
 
-  remote_driver_generated += custom_target(
+  protocol_h_generated = custom_target(
     protocol_h,
     input: protocol_x,
     output: protocol_h,
@@ -30,6 +39,9 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
     ],
   )
 
+  remote_driver_generated += protocol_h_generated
+  remote_daemon_generated += protocol_h_generated
+
   remote_driver_generated += custom_target(
     protocol_c,
     input: protocol_x,
@@ -42,15 +54,6 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
   rpc_probe_files += files(protocol_x)
 endforeach
 
-remote_daemon_sources = files(
-  'remote_daemon.c',
-  'remote_daemon_config.c',
-  'remote_daemon_dispatch.c',
-  'remote_daemon_stream.c',
-)
-
-remote_daemon_generated = []
-
 virt_ssh_helper_sources = files(
   'remote_sockets.c',
   'remote_ssh_helper.c',
-- 
2.17.1
Re: [PATCH] remote: Make remote_daemon depend on qemu_protocol.h
Posted by Michal Prívozník 1 year, 7 months ago
On 7/20/22 10:41, He Zhe wrote:
> We sometimes meet the following parallel compililation issue, since
> remote_daemon depends on remote_protocol.h qemu_protocol.h and lxc_protocol.h,
> which are usually generated due to remote_driver .
> 
> | FAILED: src/virtnetworkd.p/remote_remote_daemon_dispatch.c.o
> | x86_64-wrs-linux-gcc ...
> | In file included from ../libvirt-8.1.0/src/remote/remote_daemon_dispatch.c:26:
> | ../libvirt-8.1.0/src/remote/remote_daemon.h:30:10: fatal error: qemu_protocol.h: No such file or directory
> |    30 | #include "qemu_protocol.h"
> |       |          ^~~~~~~~~~~~~~~~~
> | compilation terminated.
> 
> This patch adds the headers as dependencies of remote_daemon to make sure they
> are always in place in advance.
> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  src/remote/meson.build | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)

Hm.. I'm failing to reproduce the build error, even though I put
sleep(5) into both src/rpc/gendispatch.pl and src/rpc/genprotocol.pl and
I try in a machine with 384 cores. I even wrapped rpcgen in a shell
script to insert a short sleep.

In the commit message you mention libvirt-8.1.0, does this problem still
occurs even with the current master?

Michal
Re: [PATCH] remote: Make remote_daemon depend on qemu_protocol.h
Posted by He Zhe 1 year, 7 months ago

On 8/8/22 22:59, Michal Prívozník wrote:
> On 7/20/22 10:41, He Zhe wrote:
>> We sometimes meet the following parallel compililation issue, since
>> remote_daemon depends on remote_protocol.h qemu_protocol.h and lxc_protocol.h,
>> which are usually generated due to remote_driver .
>>
>> | FAILED: src/virtnetworkd.p/remote_remote_daemon_dispatch.c.o
>> | x86_64-wrs-linux-gcc ...
>> | In file included from ../libvirt-8.1.0/src/remote/remote_daemon_dispatch.c:26:
>> | ../libvirt-8.1.0/src/remote/remote_daemon.h:30:10: fatal error: qemu_protocol.h: No such file or directory
>> |    30 | #include "qemu_protocol.h"
>> |       |          ^~~~~~~~~~~~~~~~~
>> | compilation terminated.
>>
>> This patch adds the headers as dependencies of remote_daemon to make sure they
>> are always in place in advance.
>>
>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>> ---
>>  src/remote/meson.build | 23 +++++++++++++----------
>>  1 file changed, 13 insertions(+), 10 deletions(-)
> Hm.. I'm failing to reproduce the build error, even though I put
> sleep(5) into both src/rpc/gendispatch.pl and src/rpc/genprotocol.pl and
> I try in a machine with 384 cores. I even wrapped rpcgen in a shell
> script to insert a short sleep.
>
> In the commit message you mention libvirt-8.1.0, does this problem still
> occurs even with the current master?

Thanks for taking care of this.

Yes, this is a rare case. We build libvirt everyday and only saw this twice so
far. We haven't upgraded to a newer version. Even if it's done, we might not
expect it's reproduced soon...indeed

Looking at the meson.build, the dependencies are still missing on current
master.


Zhe

>
> Michal
>