If you really use libvirt C language dynamic link library for programming, you need to install the libvirt Installation File
Download libvirt9.9.0-tar.gz and decompress the file tar zxvf.
Libvirt-0.9.0.tar.gz. After decompression is complete, go to the folder
Libvirt-0.9.0 start Installation
1../configure
2. If libxml2 is missing, install libxml2.sudo apt-Get install libxml2.
Libxml2-dev
Attachment: ftp://xmlsoft.org/libxml2/ if manually installed
3. Re-./configure. A message indicating that the guntls cannot be found is displayed.
4. Install the guntls library. Sudo apt-Get install gnutls-Doc gnutls-bin, sudo
Apt-Get install libneon27-gnutls libcurl4-gnutls-dev.
5. Then./configure, and the system prompts that the device-mapper-devel is missing,
6. Download The device-mapper.1.02.28.tgz from the Internet and decompress tar zxvf
Device-mapper.1.02.28.tgz,
Go to the decompressed Folder: CD device-mapper.1.02.28. Install device-mapper.
(1)./configure
(2) sudo
Make
(3) sudo
Make install
Then exit the folder and reinstall libvirt.
7. Entering the libvirt-0.9.0,./configure, no error
8. sudo make
9. sudo make install
Libvirt has been installed. However, if you want to use virsh, you need to use the absolute path of virsh.
(If virsh is run at this time, an error occurs. According to the prompt, we think it is caused by libvirt dependency. In order to use virsh Shell
Script,
We can use the original absolute path of virsh to find this executable file. For example, usr/bin/virsh)
Use of C language library
After editing the. cpp Source Code (for example, myxm. cpp), compile g ++ myxm. cpp-lvirt-O myxm in the command line.
Then run./myxm.
Libgcrypt: http://mirrors.dotsrc.org/gcrypt/libgcrypt/