Compiling fails with "nested redefinition of 'enum can_state'"
Hi,
I'm trying to cross-compile liblely-io
with the help of the Yocto Project and
have encountered the following issue:
There is a naming collision for enum can_state
with two different definitions
that come from the Linux kernel and liblely-can
:
In file included from ../../git/src/can.c:44:0:
/path/to/liblely-io/1.2.3-r0/recipe-sysroot/usr/include/linux/can/netlink.h:69:6: error: nested redefinition of 'enum can_state'
enum can_state {
^~~~~~~~~
/path/to/liblely-io/1.2.3-r0/recipe-sysroot/usr/include/linux/can/netlink.h:69:6: error: redeclaration of 'enum can_state'
In file included from /path/to/liblely-io/1.2.3-r0/recipe-sysroot/usr/include/lely/can/msg.h:26:0,
from /path/to/liblely-io/1.2.3-r0/recipe-sysroot/usr/include/lely/can/socket.h:25,
from ../../git/src/can.c:27:
/path/to/liblely-io/1.2.3-r0/recipe-sysroot/usr/include/lely/can/can.h:36:6: note: originally defined here
enum can_state {
^~~~~~~~~
I'm using GCC 7.3.0.
Explicitly specifying -std=c11
still yields the same error message.
I've also tried to build liblely-core
in a similar way, and that project
surprisingly compiles without the type clash being considered as an error.
Attached you find the log file of the compile steps for both liblely-io
(failure) and liblely-core
(success).