Re: [PATCH] Avoid link errors with "configure --disable-shared".

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 29, 2008 at 05:01:17PM +0100, Jim Meyering wrote:
> "Richard W.M. Jones" <rjones@xxxxxxxxxx> wrote:
> > Jim Meyering wrote:
> >> I tried to build static binaries in the usual libtool way,
> >> via "configure --disable-shared" and got some link errors
> >> due to the tests linking only with shared-lib-related files.
> >> Here's the fix:
> >>
> >> 	Avoid link errors with "configure --disable-shared".
> >> 	* tests/Makefile.am (LDADDS): Add ../src/libvirt.la, so that
> >> 	"configure --disable-shared" no longer provokes link errors.
> >>
> >> ---
> >>  tests/Makefile.am |    1 +
> >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/tests/Makefile.am b/tests/Makefile.am
> >> index dfd9e34..1b5f287 100644
> >> --- a/tests/Makefile.am
> >> +++ b/tests/Makefile.am
> >> @@ -33,6 +33,7 @@ LDADDS = \
> >>          $(SASL_LIBS) \
> >>          $(WARN_CFLAGS) \
> >>  	$(LIBVIRT) \
> >> +	../src/libvirt.la \
> >>  	../gnulib/lib/libgnu.la \
> >>          $(COVERAGE_LDFLAGS)
> >
> > Not sure I understand this one.
> >
> > LIBVIRT is defined as:
> >
> >   LIBVIRT = $(wildcard $(top_builddir)/src/.libs/libvirt_la-*.o)
> >
> > Doesn't that work in the static case too?
> 
> Unfortunately not, since the wildcard doesn't match anything:
> 
>     $ ls -1 ../src/.libs/libvirt*
>     ../src/.libs/libvirt.a
>     ../src/.libs/libvirt.la@
>     ../src/.libs/libvirt.lai


Even in the shared case, it doesn't really work too well - if you 
make clean you can often end up with this pulling in too many files.
I don't particuarly like this bit of the tests Makefile, but I could
not find any other way to getting the coverage data to work correctly
at the time. 

The problem is only wrt to the test case which invokes virsh - all the
others work fine. Its just that virsh gets linked & invoked in a differnet
context to the other scripts. The possible way around it is to not invoke
virsh binary from the test suite - instead just compile virsh.c straight
into the virsh test case & call its main() method. I never got around to
testing this idea. If it works, then we could remove the wildcard and
just link to libvirt.la as normal

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]