[ovs-dev] Help with error in <linux/types.h> when compiling custom library

Jordi Palà jordipalasole at gmail.com
Tue Aug 5 15:22:41 UTC 2014

Dear all,

We are testing a custom library that we want to include to
openvswitch. This library uses netlink and the -DCONFIG_LIBNL20
compilation flag.

We can compile the library standalone and it works, but when we add it
to openvswitch the compilation crashes.

The way we add the library to openvswicth is the following:

1) In lib/automake.mk we add:


lib_libopenvswitch_la_SOURCES = \
lib/my_library.c \

2) However, when compiling we get the following error

In file included from /usr/include/linux/rtnetlink.h:8:0,
                 from /usr/include/netlink/netlink.h:26,
                 from /usr/include/netlink/genl/genl.h:15,
                 from lib/my_library.h:21,
                 from lib/my_library.c:1:
/usr/include/linux/neighbour.h:11:2: error: unknown type name '__s32'

/usr/include/linux/neighbour.h includes /usr/include/linux/types.h who
should be able to find the type __s32. Indeed the chain of includes in
/usr/include/ should be:

neighbour.h -->  <asm/types.h> --> (I assume this translates into
asm-generic/types.h) --> <asm-generic/int-ll64.h> ---> __s32 is
defined here.

What puzzles me is that if we compile the library outside openvswitch
everything works fine, and /usr/include/linux/neighbour.h can find the
type. This is the compilation command that works from outside

gcc -O2 -g -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
-DCONFIG_LIBNL20 -c -o my_library.o my_library.c

Any help is appreciated.

Best Regards

Jordi Pala

More information about the dev mailing list