[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libvirt-users
Subject:    Re: Regarding location of Libvirt library
From:       Andrea Bolognani <abologna () redhat ! com>
Date:       2021-03-31 17:19:30
Message-ID: 157c6f30a9f157fc7fba6c2bed5d234e51219be8.camel () redhat ! com
[Download RAW message or body]

On Wed, 2021-03-31 at 17:01 +0200, Michal Privoznik wrote:
> On 3/31/21 7:38 AM, shafnamol N wrote:
> > Hi,
> > I have installed Libvirt 7.1.0.
> > I configured and built libvirt based on instructions from
> > https://libvirt.org/compiling.html <https://libvirt.org/compiling.html>;;.
> > Now I developed a client program to create a VM using an XML file.As the 
> > API for it is *virDomainCreateXML,* called this API by passing XML file 
> > .It shows the following error.
> > undefined reference to `virDomainCreateXML'.
> > I included the header files containing the said API declaration.But need 
> > to include the library also.
> > My question is where do the libvirt library located after building it.
> 
> Yes, you need to pass -lvirt when linking. The library is installed 
> wherever you told it to install. If you ran plain meson with no extra 
> arguments, then 'meson install' installs library under /usr/local/lib/ 
> or /usr/local/lib64/. So you will need to pass -L/usr/local/lib or 
> -L/usr/local/lib64 too to the linker.
> 
> But there is this switch -Dsystem=true which tells meson to install into 
> system directories:
> 
>    meson -Dsystem=true build
>    meson install -C build
> 
> with this you will not need to pass any extra -L arguments to the linker.

Note that the recommended way to obtain this information is via
pkg-config, using something like

  $ pkg-config --cflags --libs libvirt

If you get an error about libvirt not being found, you probably need
to run

  $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

or something along those lines beforehand.

-- 
Andrea Bolognani / Red Hat / Virtualization

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic