[libvirt] [PATCH] build: Fix VPATH build with new probes

Eric Blake eblake at redhat.com
Tue Oct 11 18:45:08 UTC 2011


On 10/11/2011 08:49 AM, Jiri Denemark wrote:
> Note that make check still fails for me in VPATH build because od
> undefined references in libvirt_test.a which I don't really understand
> since src/Makefile.am contains
> libvirt_la_LIBADD += probes.o
> libvirt_test_la_LIBADD = $(libvirt_la_LIBADD)
>
> This is a sample of the erros I get:
>
> ../src/.libs/libvirt_test.a(libvirt_net_rpc_client_la-virnetclient.o):
> In function `virNetClientCallDispatch':
> /home/jirka/work/libvirt/git/upstream/src/rpc/virnetclient.c:690:
> undefined reference to `libvirt_rpc_client_msg_rx_semaphore'
> ../src/.libs/libvirt_test.a(libvirt_net_rpc_client_la-virnetclient.o):
> In function `virNetClientRef':
> /home/jirka/work/libvirt/git/upstream/src/rpc/virnetclient.c:234:
> undefined reference to `libvirt_rpc_client_ref_semaphore'
> ../src/.libs/libvirt_test.a(libvirt_net_rpc_client_la-virnetclient.o):

In looking at this further, it looks like the libtool warnings are relevant:

*** Warning: Linking the shared library libvirt.la against the non-libtool
*** objects  probes.o is not portable!

When creating libvirt.la (the libtool driver for the eventual installed 
libvirt.so), the warning is issued, but libtool still compiles probe.o 
into the overall library for any platform that can handle it (Linux can, 
and we don't build probe.o anywhere else, so we are okay).  This 
compilation is done via $CC.

But libvirt_test.la is a different beast - since it is never installed, 
but just a convenience library, libtool creates the library using raw 
invocations of '$AR cru' from the piecemeal list of .o files extracted 
from each other convenience library, and omits probe.o.

Perhaps we could argue that this is a libtool bug for not putting .o 
files into convenience libraries, even though it does so for installed 
libraries.  But getting that fixed in libtool, then requiring the newer 
libtool before we can build libvirt in the future, seems time-consuming.

On the other hand, looking further, src/Makefile.am ends up building the 
libvirt_lxc executable, and explicitly adds probes.o to 
libvirt_lxc_LDADD, which then gets compiled in without any warnings.

So it looks like instead of trying to jam probes.o into libvirt_test.la, 
we should instead tweak tests/Makefile.am so that every executable that 
links against libvirt_test.la also links against probes.o, similar to 
how libvirt_lxc_LDADD worked for that executable.

I'm still playing with the issue, but hope to have 'make check' working 
again sometime today.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list