The problem arises when the gdbus-codegen binary exists but the pkg-config file for it (dbus-glib-1.pc) doesnt.
configure lines 3328 - 3334:
gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
if [ ! -x "$gdbus_codegen" ]; then
gdbus_codegen=
fi
So if pkg-config can't find gdbus_codegen, $gdbus_codegen will be blank. It is used again on line 5687:
if test "$gio" = "yes" ; then
echo "CONFIG_GIO=y" >> $config_host_mak
echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
echo "GIO_LIBS=$gio_libs" >> $config_host_mak
echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
fi
The problem is that it doesn't check whether $gdbus_codegen is blank or not. So now we have GDBUS_CODEGEN set to "" in config_host, which gets passed on to meson.
tests/qtest/meson.build lines 70 - 80:
dbus_daemon = find_program('dbus-daemon', required: false)
if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN')
# Temporarily disabled due to Patchew failures:
#qtests_i386 += ['dbus-vmstate-test']
dbus_vmstate1 = custom_target('dbus-vmstate description',
output: ['dbus-vmstate1.h', 'dbus-vmstate1.c'],
input: files('dbus-vmstate1.xml'),
command: [config_host['GDBUS_CODEGEN'],
'@INPUT@',
'--interface-prefix', 'org.qemu',
'--generate-c-code', '@BASENAME@']).to_list()
config_host.has_key('GDBUS_CODEGEN') evaluates to true because the key does exist - it's just blank. dbus_daemon.found() also evaluates to true because the relevant binary does exist - it's just the .pc file that's missing. Then custom_target tries to run this blank executable path, leading to this error when configure is run:
Program dbus-daemon found: YES (/usr/bin/dbus-daemon)
../tests/qtest/meson.build:74:18: ERROR: Program '' not found or not executable
The PR fixes this by only putting GDBUS_CODEGEN into $config_host_mak if it's not blank.
Reproducing the error
On debian, install libglib2.0-dev-bin (which gives you /usr/bin/gdbus-codegen) but not libdbus-glib-1-dev (which gives you /usr/lib/x86_64-linux-gnu/pkgconfig/dbus-glib-1.pc) and run configure.
Here was the exact configure command I used, although I don't think it's necessary to reproduce the bug:
The problem arises when the
gdbus-codegen
binary exists but the pkg-config file for it (dbus-glib-1.pc
) doesnt.configure
lines 3328 - 3334:So if
pkg-config
can't findgdbus_codegen
,$gdbus_codegen
will be blank. It is used again on line 5687:The problem is that it doesn't check whether
$gdbus_codegen
is blank or not. So now we haveGDBUS_CODEGEN
set to""
inconfig_host
, which gets passed on to meson.tests/qtest/meson.build
lines 70 - 80:config_host.has_key('GDBUS_CODEGEN')
evaluates to true because the key does exist - it's just blank.dbus_daemon.found()
also evaluates to true because the relevant binary does exist - it's just the.pc
file that's missing. Thencustom_target
tries to run this blank executable path, leading to this error whenconfigure
is run:The PR fixes this by only putting
GDBUS_CODEGEN
into$config_host_mak
if it's not blank.Reproducing the error
On debian, install
libglib2.0-dev-bin
(which gives you/usr/bin/gdbus-codegen
) but notlibdbus-glib-1-dev
(which gives you/usr/lib/x86_64-linux-gnu/pkgconfig/dbus-glib-1.pc
) and runconfigure
.Here was the exact configure command I used, although I don't think it's necessary to reproduce the bug:
I was trying to cross-compile qemuafl which is why it's such a mess.
Let me know if something is off, I'm a bit new to this PR stuff.