If you want to do a minimal build of libvirt you can run meson with
--auto-features=disabled which will disable most of the features and you
can explicitly enable only the things that you want to use (this is what
most distributions are doing when building packages). I just noticed
that there are some build options where this doesn't work so I'll post
patches to fix them.
When you happen to do this, can you share a link where I can download the
patches?
The last part I have to ask what do you mean by "without dynamic lib
dependencies"? If you mean that libvirt.so should be statically
linked
that is not currently possible. We would have to add option to make it
possible and update all dependency() and find_library() calls in all
meson.build files to look only for static libraries.
Uh, I wonder what the meson option
default_library shared
[shared, static, both]
is for?
In addition I think we should add build options which would allow users
to disable tests, documentation, examples and other bits that
end-users
don't have to use.
That makes sense.
Thank you Martin and Pavel for replying back so quickly. I'll try to do the
compilation with the auto features disabled and see how long I can go
from there, this is probably going to be a whack-a-mole game
On Thu, Oct 8, 2020 at 3:18 AM Pavel Hrdina <phrdina(a)redhat.com> wrote:
> On Thu, Oct 08, 2020 at 09:38:22AM +0200, Martin Kletzander wrote:
> > On Wed, Oct 07, 2020 at 04:50:26PM -0700, Román González wrote:
> > > Hello there,
> > >
> > > I'm trying to play with musl and libvirt to see if I'm able to
build a
> > > libvirt client binary without dynamic lib dependencies. I have two
> > > questions:
> > >
> > > 1) to your knowledge, is this exercise futile?
> > >
> > > 2) Do you know if there is a way to *only* compile the library bits?
> > >
> > > I want to reduce the number of dependencies in the build, and only
> > > construct the libvirt libraries, not libvirtd nor virsh.
> > >
> >
> > You can disable building the daemon with -Ddriver_libvirtd=disabled (if
> I am
> > reading the code correctly). I do not think there is something similar
> for the
> > clients, but I might be wrong. Pavel (Cc'd) would definitely know or at
> least
> > be able to find it out more easily. If it is not possible now then it
> should
> > not be that difficult to add such option, I think.
>
> Correct, using that option you can disable libvirtd which should reduce
> some dependencies but there is no option to disable virsh. We can
> possibly introduce an option to disable libvirt clients but that would
> save you only readline as a dependency which you can disable by using
> -Dreadline=disabled .
If you want to do a minimal build of libvirt you can run meson with
--auto-features=disabled which will disable most of the features and you
can explicitly enable only the things that you want to use (this is what
most distributions are doing when building packages). I just noticed
that there are some build options where this doesn't work so I'll post
patches to fix them.
>
> The last part I have to ask what do you mean by "without dynamic lib
dependencies"? If you mean that libvirt.so should be statically
linked
that is not currently possible. We would have to add option to make it
possible and update all dependency() and find_library() calls in all
meson.build files to look only for static libraries.
> In addition I think we should add build options which would allow users
to disable tests, documentation, examples and other bits that
end-users
don't have to use.
> Pavel
>