Hello. I think this error happens because of the order of includes in datapath/linux/Kbuild makefile. Directory datapath/linux/compat/include is included before kcompat.h.
Here is debug info: http://paste.openstack.org/raw/C6FApxHI5Dzc1lp2IT8f/ Try to apply this patch to ovs sources and then build kernel module: --- datapath/linux/Kbuild.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath/linux/Kbuild.in b/datapath/linux/Kbuild.in index 9e3259f19..395b0cbc0 100644 --- a/datapath/linux/Kbuild.in +++ b/datapath/linux/Kbuild.in @@ -16,7 +16,7 @@ ccflags-y += -include $(builddir)/kcompat.h # These include directories have to go before -I$(KSRC)/include. # NOSTDINC_FLAGS just happens to be a variable that goes in the # right place, even though it's conceptually incorrect. -NOSTDINC_FLAGS += -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include +NOSTDINC_FLAGS += -include $(builddir)/kcompat.h -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include obj-m := $(subst _,-,$(patsubst %,%.o,$(build_modules))) -- I'm not sure if this solution is completely correct, but ovs kernel module can be built now. - Regards, Vlad On Fri, May 25, 2018 at 2:55 PM, Vadim Ponomarev <[email protected]> wrote: > I tried to build OVS 2.9.1 from source but modules build failed with error: > > make: Entering directory '/usr/src/openvswitch-2.9.1/datapath/linux' > make -C /lib/modules/4.15.0-22-generic/build > M=/usr/src/openvswitch-2.9.1/datapath/linux > modules > make[1]: Entering directory '/usr/src/linux-headers-4.15.0-22-generic' > CC [M] /usr/src/openvswitch-2.9.1/datapath/linux/actions.o > In file included from ./include/linux/compiler_types.h:58:0, > from ././include/linux/kconfig.h:74, > from <command-line>:0: > /usr/src/openvswitch-2.9.1/datapath/linux/compat/include/linux/compiler-gcc.h:3:2: > error: #error "Please don't include <linux/compiler-gcc.h> directly, > include <linux/compiler.h> instead." > #error "Please don't include <linux/compiler-gcc.h> directly, include > <linux/compiler.h> instead." > ^ > scripts/Makefile.build:332: recipe for target > '/usr/src/openvswitch-2.9.1/datapath/linux/actions.o' > failed > make[2]: *** [/usr/src/openvswitch-2.9.1/datapath/linux/actions.o] Error 1 > Makefile:1552: recipe for target > '_module_/usr/src/openvswitch-2.9.1/datapath/linux' > failed > make[1]: *** [_module_/usr/src/openvswitch-2.9.1/datapath/linux] Error 2 > make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-22-generic' > Makefile.main:71: recipe for target 'default' failed > make: *** [default] Error 2 > make: Leaving directory '/usr/src/openvswitch-2.9.1/datapath/linux' > > Did anyone saw this error? Is it a bug or am I wrong? > >
_______________________________________________ discuss mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
