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

Message ID 1460364631-28381-1-git-send-email-yong.liu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Marvin Liu April 11, 2016, 8:50 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, 9:26 a.m. UTC | #1
2016-04-11 16:50, Marvin Liu:
> Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

As commented earlier, I don't think it is the origin of the issue.

> +$(info "vm_power_manager required libvirt version >= 0.9.3, please update libvirt-devel first")

"required" should be "requires".
libvirt-devel is the name of the package on some distributions, but
it is not always the case. Moreover, the whole libvirt package must be
updated atomically, not only the headers. That's why I think it's better
to remove this part and just keep:
	"vm_power_manager requires libvirt version >= 0.9.3"

Other issue: it would better to use $(error to generate a compilation error.
But the example should not be skipped from examples/Makefile in this case.
  
Thomas Monjalon April 11, 2016, 9:32 a.m. UTC | #2
2016-04-11 11:26, Thomas Monjalon:
> 2016-04-11 16:50, Marvin Liu:
> > Fixes: 2e099bc5d104 ("fix split of compiler and linker options")
> 
> As commented earlier, I don't think it is the origin of the issue.
> 
> > +$(info "vm_power_manager required libvirt version >= 0.9.3, please update libvirt-devel first")
> 
> "required" should be "requires".
> libvirt-devel is the name of the package on some distributions, but
> it is not always the case. Moreover, the whole libvirt package must be
> updated atomically, not only the headers. That's why I think it's better
> to remove this part and just keep:
> 	"vm_power_manager requires libvirt version >= 0.9.3"
> 
> Other issue: it would better to use $(error to generate a compilation error.
> But the example should not be skipped from examples/Makefile in this case.

Sorry I mean the example *should be* skipped from examples/Makefile,
with the small message "vm_power_manager requires libvirt >= 0.9.3".
  
Marvin Liu April 11, 2016, 9:46 a.m. UTC | #3
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, April 11, 2016 5:27 PM
> To: Liu, Yong
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] examples/vm_power_manager: fix build
> with libvirt version < 0.9.3
> 
> 2016-04-11 16:50, Marvin Liu:
> > Fixes: 2e099bc5d104 ("fix split of compiler and linker options")
> 
> As commented earlier, I don't think it is the origin of the issue.
> 
Yes, this issue existed from the original. 2e099bc5d104 is the first buildable version. I will change commit to original version. 

> > +$(info "vm_power_manager required libvirt version >= 0.9.3, please
> update libvirt-devel first")
> 
> "required" should be "requires".
> libvirt-devel is the name of the package on some distributions, but
> it is not always the case. Moreover, the whole libvirt package must be
> updated atomically, not only the headers. That's why I think it's better
> to remove this part and just keep:
> 	"vm_power_manager requires libvirt version >= 0.9.3"
> 
> Other issue: it would better to use $(error to generate a compilation
> error.
> But the example should not be skipped from examples/Makefile in this case.

Thanks, will generate error when libvirt not meet requirement.
  

Patch

diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile
index 113dbc4..08e301f 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -36,6 +36,9 @@  endif
 # Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
+# check libvirt version >= 0.9.3
+ifeq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
+
 include $(RTE_SDK)/mk/rte.vars.mk
 
 # binary name
@@ -57,3 +60,10 @@  CFLAGS_main.o += -Wno-return-type
 endif
 
 include $(RTE_SDK)/mk/rte.extapp.mk
+
+else
+.PHONY: all clean
+all:
+$(info "vm_power_manager required libvirt version >= 0.9.3, please update libvirt-devel first")
+clean:
+endif