
On Tue, Apr 27, 2010 at 05:36:40PM -0400, Chris Lalancette wrote:
On 04/27/2010 04:25 PM, Daniel P. Berrange wrote:
Causes the build to fail when linking virsh:
CCLD virsh ../src/.libs/libvirt-qemu.so: undefined reference to `qemuMonitorCommand' collect2: ld returned 1 exit status
Indeed, if I nm src/.libs/libvirt-qemu.so:
[clalance@localhost libvirt (qemu_monitor)]$ nm src/.libs/libvirt-qemu.so | grep Monitor U qemuMonitorCommand U remoteQemuMonitorCommand@@LIBVIRT_PRIVATE_0.8.0 000010b0 T virDomainQemuMonitorCommand
Any suggestions about what I'm doing wrong?
Have you re-ordered your patches ? There is a qemuMonitorCommand defined in src/qemu/qemu_monitor_text.c but that is static. The qemuMonitorCommand you actually want is not added till your next patch. So perhaps your old code was pullin in the wrong definition ?
It'd be good to rename this to reflect the public API name and avoid the clash
I did not re-order my patches, but you are right, there is a name clash. I've now resolved that as you suggested (calling the external function qemuDomainMonitorCommand).
That's not actually the problem, though. What's happening is that src/Makefile.am has this:
if WITH_QEMU if WITH_DRIVER_MODULES mod_LTLIBRARIES += libvirt_driver_qemu.la else noinst_LTLIBRARIES += libvirt_driver_qemu.la # Stateful, so linked to daemon instead #libvirt_la_LIBADD += libvirt_driver_qemu.la
i.e. libvirt_driver_qemu.la is not being added to libvirt.la, so that's why my linking step in virsh is failing (and *not* failing when linking libvirtd). So I think I need to manually specify libvirt_qemu.la in my libvirt_qemu_la_LIBADD to avoid this failure.
Ahh, damn. This is a result of my suggestion to you not to use the virDriver struct for dispatching these methods :-( It means that the main libvirt-qemu.c file gets a direct dependancy on the QEMU driver code, instead of indirectly via the driver table. So I'm afraid I was wrong & you should go back to using the driver table for dispatch Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|