[libvirt] Likely build race, "/usr/bin/ld: cannot find -lvirt"

Jiri Denemark jdenemar at redhat.com
Tue Jun 12 11:11:45 UTC 2018


On Thu, May 24, 2018 at 15:52:55 -0600, Jim Fehlig wrote:
> On 05/24/2018 04:27 AM, Ian Jackson wrote:
> > Ian Jackson writes ("Likely build race, "/usr/bin/ld: cannot find -lvirt""):
> >> tl;dr:
> >>
> >> I think there is a bug in libvirt's build system which, with
> >> low probability, causes a build failure containing this message:
> >>    /usr/bin/ld: cannot find -lvirt
> >>
> >> Complete build logs of two attempts:
> >>
> >>    http://logs.test-lab.xenproject.org/osstest/logs/123046/build-i386-libvirt/6.ts-libvirt-build.log
> >>
> >>    http://logs.test-lab.xenproject.org/osstest/logs/123096/build-i386-libvirt/6.ts-libvirt-build.log
> > 
> > I have run a number of attempts.  Out of 5 more, 1 succeeded.  So out
> > of a total of 7 attempts, 1 succeeded.  This repro rate is an IMO
> > excellent opportunity to debug this race :-).
> 
> There appears to be a missing dependency between the lockd library and libvirt 
> library, but my autotools skills lack the savvy to find it. Here we see the 
> install command and relinking of lockd.la

I hit the same race twice on aarch64 and ppc64 and I can confirm the
installation phase fails if libvirt.la is installed later than libraries
which link to it. However, the dependencies seem to be set correctly in
the Makefiles. But it looks like they are only honored when linking the
library during the build phase. During make install libvirt.la and
libraries which link to it are installed independently. That is,
install-modLTLIBRARIES does not depend on anything except for the
mod_LTIBRARIES themselves. Thus when libtool decides to relink the
libraries libvirt.la may still be missing at this point. Manually
changing

    install-modLTLIBRARIES: $(mod_LTLIBRARIES)

to

    install-modLTLIBRARIES: $(mod_LTLIBRARIES) install-libLTLIBRARIES

fixed the problem for me (tested with an artificial delay added to
install-libLTLIBRARIES target), but I have no idea how to persuade
automake to generate something like that for us.

Eric, is my investigation correct and do you have any ideas on how to
fix the race?

Jirka




More information about the libvir-list mailing list