[libvirt] fix build failure with --disable-shared

Daniel P. Berrange berrange at redhat.com
Fri Jan 8 11:53:25 UTC 2010


On Fri, Jan 08, 2010 at 12:21:44PM +0100, Diego Elio ???Flameeyes??? Petten? wrote:
> Il giorno ven, 08/01/2010 alle 11.16 +0000, Daniel P. Berrange ha
> scritto:
> > 
> > 
> > What problems do shared libraries cause with GDB - I've never had any
> > trouble with it at all - it 'just works' perfectly picking up any
> > debuginfo
> > packages from things we link against too. The only GDB issues I see
> > are its
> > inability to cope with -O2 optimized code. 
> 
> I think what they meant is not much related to shared libraries (which
> works pretty good with gdb) but with the handling of dynamically-linked
> executables and libtool: launching gdb ./virsh will not work, obviously;
> you either launch it directly (./.libs/virsh), but most people will
> forget to set the proper LD_LIBRARY_PATH entries and thus debug the
> installed copy of the libraries, or you pass through libtool, but most
> people don't know that.

Hmm using --disable-shared is really not the right solution to that
problem. For people that can't rememver the long libtool command name
it is easy to create a wrapper

  $ cat ~/usr/bin/ltrun 
  #!/bin/sh

  exec libtool --mode=execute "$@"

Then you can just do this which isn't hard to remember or type

   ltrun gdb ./virsh

Switching to static build to debug something is craziness, because it can
and will change the behaviour of many memory-corruption related problems
so that something you see fail with shared library build won't reproduce
in the same way with a static build. 

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list