I was really only wanting to make sure that both remote_driver and remote_daemon have access to lxc_protocol.h. I am not an expert in meson builds but I think the only way to do that is have a loop outside of remote_daemon_generated and remote_driver_generated. You could start with an empty remote_daemon_generated and append remote_xxx_generated after the foreach loop instead of initializing the way I did. So, your 1) is just a side-effect, not something I was explicitly seeking. Joe > -----Original Message----- > From: Michal Prívozník <mprivozn@xxxxxxxxxx> > Sent: Monday, March 14, 2022 3:13 AM > To: Slater, Joseph <joe.slater@xxxxxxxxxxxxx>; libvir-list@xxxxxxxxxx > Cc: MacLeod, Randy <Randy.MacLeod@xxxxxxxxxxxxx> > Subject: Re: [PATCH] add build dependency on lxc_protocol.h to > remote_daemon > > On 3/10/22 21:53, Joe Slater wrote: > > remote_daemon.c and others need the generated header lxc_protocol.h, > > but do not have it as a dependency in meson.build. This means that > > builds will randomly (ok, very occasionally) fail. Restructure how > > the header is built so that remote_daemon can have it as a dependency. > > > > Signed-off-by: Joe Slater <joe.slater@xxxxxxxxxxxxx> > > > > --- > > src/remote/meson.build | 48 > > ++++++++++++++++++++++++------------------ > > 1 file changed, 28 insertions(+), 20 deletions(-) > > > > diff --git a/src/remote/meson.build b/src/remote/meson.build index > > 0a18826..31a30ee 100644 > > --- a/src/remote/meson.build > > +++ b/src/remote/meson.build > > @@ -1,27 +1,11 @@ > > -remote_driver_sources = [ > > - 'remote_driver.c', > > - 'remote_sockets.c', > > -] > > - > > -remote_driver_generated = [] > > +remote_xxx_generated = [] > > > > foreach name : [ 'remote', 'qemu', 'lxc' ] > > - client_bodies_h = '@0@_client_bodies.h'.format(name) > > protocol_c = '@0@_protocol.c'.format(name) > > protocol_h = '@0@_protocol.h'.format(name) > > protocol_x = '@0@_protocol.x'.format(name) > > > > - remote_driver_generated += custom_target( > > - client_bodies_h, > > - input: protocol_x, > > - output: client_bodies_h, > > - command: [ > > - gendispatch_prog, '--mode=client', name, name.to_upper(), '@INPUT@', > > - ], > > - capture: true, > > - ) > > - > > - remote_driver_generated += custom_target( > > + remote_xxx_generated += custom_target( > > protocol_h, > > input: protocol_x, > > output: protocol_h, > > @@ -30,7 +14,7 @@ foreach name : [ 'remote', 'qemu', 'lxc' ] > > ], > > ) > > > > - remote_driver_generated += custom_target( > > + remote_xxx_generated += custom_target( > > protocol_c, > > input: protocol_x, > > output: protocol_c, > > @@ -42,6 +26,30 @@ foreach name : [ 'remote', 'qemu', 'lxc' ] > > rpc_probe_files += files(protocol_x) endforeach > > > > + > > +remote_driver_sources = [ > > + 'remote_driver.c', > > + 'remote_sockets.c', > > +] > > + > > +remote_driver_generated =remote_xxx_generated > > + > > +foreach name : [ 'remote', 'qemu', 'lxc' ] > > + client_bodies_h = '@0@_client_bodies.h'.format(name) > > + protocol_x = '@0@_protocol.x'.format(name) > > + > > + remote_driver_generated += custom_target( > > + client_bodies_h, > > + input: protocol_x, > > + output: client_bodies_h, > > + command: [ > > + gendispatch_prog, '--mode=client', name, name.to_upper(), '@INPUT@', > > + ], > > + capture: true, > > + ) > > + > > +endforeach > > + > > remote_daemon_sources = files( > > 'remote_daemon.c', > > 'remote_daemon_config.c', > > @@ -49,7 +57,7 @@ remote_daemon_sources = files( > > 'remote_daemon_stream.c', > > ) > > > > -remote_daemon_generated = [] > > +remote_daemon_generated = remote_xxx_generated > > So IIUC, this fix consists of two parts: > 1) generating client_bodies_h only AFTER protocol.x for all three drivers was > processed, > 2) Initializing remote_daemon_generated to remote_xxx_generated (which > contains protocol.x processing targets). > > IMO, it's only the second step that's really needed, isn't it? I'm not against this > patch, I'm just trying to confirm I understood the problem and the fix. > > Michal