[dpdk-dev] [PATCH] Pass CC option when building kernel modules

Sergio Gonzalez Monroy sergio.gonzalez.monroy at intel.com
Thu Oct 9 12:04:47 CEST 2014


On Thu, Oct 09, 2014 at 09:10:04AM +0100, Bruce Richardson wrote:
> On Wed, Oct 08, 2014 at 07:15:04PM +0200, Thomas Monjalon wrote:
> > 2014-10-06 16:57, Sergio Gonzalez Monroy:
> > > At least on kernels 3.15 or newer, DPDK build is broken for CLANG target.
> > > The issue is that the kernel build system sets the flags before including
> > > DPDK makefile and therefore assumes the incorrect compiler.
> > > 
> > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy at intel.com>
> > 
> > > --- a/mk/rte.module.mk
> > > +++ b/mk/rte.module.mk
> > > @@ -78,7 +78,7 @@ build: _postbuild
> > >  $(MODULE).ko: $(SRCS_LINKS)
> > >  	@if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi
> > >  	@$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) \
> > > -		CROSS_COMPILE=$(CROSS)
> > > +		CC=$(KERNELCC) CROSS_COMPILE=$(CROSS)
> > 
> > > --- a/mk/target/generic/rte.vars.mk
> > > +++ b/mk/target/generic/rte.vars.mk
> > > @@ -149,4 +149,6 @@ endif
> > >  export CFLAGS
> > >  export LDFLAGS
> > >  
> > > +else # ! ifeq ($(KERNELRELEASE),)
> > > +CC = $(KERNELCC)
> > >  endif
> > 
> > Why is it needed here? Setting CC in rte.module.mk is not sufficient?
> > 
> Right now, no it's not, and that's what is causing the error. However, we 
> maybe can look and see if we moved the definition in rte.module.mk we might 
> get the same effect.
> 

I just did a bit more testing and it seems like it is not necessary to reset
CC, CC set from the command line takes precedence.

I will post a v2 with the fix.

Thanks,
Sergio

> /Bruce
> 
> > Thanks
> > -- 
> > Thomas


More information about the dev mailing list