[libvirt] Problems in using Storage APIs in libvirt

Amudhan Gunasekaran gamudhan at novell.com
Wed May 21 19:06:08 UTC 2008


Hi Chris Lalancette,

Thanks for your quick reply. I just removed the already installed libvirt from my machine and did a *make install* in my CVS version of the code (which is in my machine at: /root/libvirt). The *make install* completed without any problems. But when I tried to compile the code, I get other error messages. I actually use the command: 

gcc `pkg-config --cflags --libs libvirt` -o myexample myexample.c

The error messages I got are:
Package libvirt was not found in the pkg-config search path.
Perhaps you should add the directory containing `libvirt.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libvirt' found
myexample.c:9:29: error: libvirt/libvirt.h: No such file or directory

Previously, I used the same command to compile and it compiled without any problems (if I had not used storage related apis). I think I am doing some silly mistakes. Please help me to rectify it.

Thanks,
Amudhan.


>>> Chris Lalancette <clalance at redhat.com> 05/22/08 12:10 AM >>>
Amudhan Gunasekaran wrote:
> Hi,
> 
> I am getting the following the error when I try to use ANY storage related APIs.
> 
> undefined reference to '<method name>' for example,
> 
> undefined reference to virConnectListStoragePools.
> 
> I checked in the libvirt.h and it has the method definition. I checked the libvirt.c and it has the implementations. I can not figure out why I get this error. I could use APIs related the network, for example virConnectListNetworks. Where could I have gone wrong and what are the work-arounds to solve them?
> 
> I am using SLES 10 SP2.

This probably means that libvirtd and/or virsh is still using the old copy of
the library.  If you have a libvirt package installed, and then you built the
the CVS libvirt by hand, the CVS version probably got installed somewhere to
/usr/local/lib, which is in the search path after where libvirt is probably
installed to /usr/lib.  Try removing your libvirt package and doing a "make
install" in the CVS version; you should then have everything matching up.

Chris Lalancette





More information about the libvir-list mailing list