[dpdk-dev] examples/vm_power_manager: fix build with libvirt version < 0.9.3

Message ID 1460346357-26592-1-git-send-email-yong.liu@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Marvin Liu April 11, 2016, 3:45 a.m. UTC
  vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for
retrieve domU vcpu information. This API implemented from version 0.9.3.
Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build
error. Add judgement in sample Makefile to skip unsupport environment.

examples/vm_power_manager/channel_manager.c: In function
‘update_pcpus_mask’:
channel_manager.c:117:3: error: implicit declaration of function
‘virDomainGetVcpuPinInfo’

Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

Signed-off-by: Marvin Liu <yong.liu@intel.com>
  

Comments

Thomas Monjalon April 11, 2016, 7:24 a.m. UTC | #1
2016-04-11 11:45, Marvin Liu:
> vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for
> retrieve domU vcpu information. This API implemented from version 0.9.3.
> Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build
> error. Add judgement in sample Makefile to skip unsupport environment.
> 
> examples/vm_power_manager/channel_manager.c: In function
> ‘update_pcpus_mask’:
> channel_manager.c:117:3: error: implicit declaration of function
> ‘virDomainGetVcpuPinInfo’
> 
> Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

I think the issue has always been there:
Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")

> +LIBVIRT_COMMON = libvirt-common.h
> +LIBVIRT_HEADER = libvirt.h
> +INCLUDE_PATH = /usr/include/libvirt/

You cannot assume it will be installed in this directory.
Please check the version with the standard pkg-config:
	pkg-config --atleast-version=0.9.3 libvirt
It can work even in cross compilation environment thanks to PKG_CONFIG_PATH.
  
Marvin Liu April 11, 2016, 8:48 a.m. UTC | #2
Thanks Thomas,  I'll send v2 for it.

> -----Original Message-----

> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]

> Sent: Monday, April 11, 2016 3:24 PM

> To: Liu, Yong

> Cc: dev@dpdk.org

> Subject: Re: [dpdk-dev] [PATCH] examples/vm_power_manager: fix build with

> libvirt version < 0.9.3

> 

> 2016-04-11 11:45, Marvin Liu:

> > vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for

> > retrieve domU vcpu information. This API implemented from version 0.9.3.

> > Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build

> > error. Add judgement in sample Makefile to skip unsupport environment.

> >

> > examples/vm_power_manager/channel_manager.c: In function

> > ‘update_pcpus_mask’:

> > channel_manager.c:117:3: error: implicit declaration of function

> > ‘virDomainGetVcpuPinInfo’

> >

> > Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

> 

> I think the issue has always been there:

> Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in

> host")

> 

> > +LIBVIRT_COMMON = libvirt-common.h

> > +LIBVIRT_HEADER = libvirt.h

> > +INCLUDE_PATH = /usr/include/libvirt/

> 

> You cannot assume it will be installed in this directory.

> Please check the version with the standard pkg-config:

> 	pkg-config --atleast-version=0.9.3 libvirt

> It can work even in cross compilation environment thanks to

> PKG_CONFIG_PATH.
  

Patch

diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile
index 113dbc4..49a6b9b 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -33,9 +33,19 @@  ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
+LIBVIRT_COMMON = libvirt-common.h
+LIBVIRT_HEADER = libvirt.h
+INCLUDE_PATH = /usr/include/libvirt/
+
+HEADER_FILE = $(shell if [ -f $(INCLUDE_PATH)$(LIBVIRT_COMMON) ]; then echo $(LIBVIRT_COMMON);else echo $(LIBVIRT_HEADER); fi;)
+LIBVIRT_INCLUDE = $(INCLUDE_PATH)$(HEADER_FILE)
+
+LIBVIR_VER = $(shell gawk '/LIBVIR_VERSION_NUMBER .*/{print $$3}' $(LIBVIRT_INCLUDE))
+
 # Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
+ifeq ($(shell test $(LIBVIR_VER) -ge 00009003 && echo 1), 1)
 include $(RTE_SDK)/mk/rte.vars.mk
 
 # binary name
@@ -57,3 +67,10 @@  CFLAGS_main.o += -Wno-return-type
 endif
 
 include $(RTE_SDK)/mk/rte.extapp.mk
+
+else
+.PHONY: all clean
+all:
+$(warning "vm_power_manager required libvirt version >= 0.9.3, please update libvirt-devel first")
+clean:
+endif