alexmohr / usb-can

USB-CAN Analyzer Linux Support
GNU General Public License v2.0
36 stars 13 forks source link

Build error from pull request #22 #24

Closed JohnTGZ closed 3 years ago

JohnTGZ commented 3 years ago

I encountered a build error that resulted from the merged pull request 22:

Building module
make -C /lib/modules/5.8.0-63-generic/build/ M=/home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module modules
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-63-generic'
  CC [M]  /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.o
/home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.c:178:21: error: redefinition of ‘skb_put_data’
  178 | static inline void *skb_put_data(struct sk_buff *skb, const void *data,
      |                     ^~~~~~~~~~~~
In file included from ./include/linux/if_ether.h:19,
                 from ./include/uapi/linux/ethtool.h:19,
                 from ./include/linux/ethtool.h:18,
                 from ./include/linux/netdevice.h:37,
                 from /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.c:49:
./include/linux/skbuff.h:2255:21: note: previous definition of ‘skb_put_data’ was here
 2255 | static inline void *skb_put_data(struct sk_buff *skb, const void *data,
      |                     ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:286: /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.o] Error 1
make[1]: *** [Makefile:1785: /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-63-generic'
make: *** [Makefile:11: all] Error 2
Building userpace tools
make: Nothing to be done for 'all'.
john@john-Legion-Y7000-2019:~/catkin_ws/src/flexa-robot/drivers/usb-can$ ./build.sh
Building module
make -C /lib/modules/5.8.0-63-generic/build/ M=/home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module modules
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-63-generic'
  CC [M]  /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.o
/home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.c:178:21: error: redefinition of ‘skb_put_data’
  178 | static inline void *skb_put_data(struct sk_buff *skb, const void *data,
      |                     ^~~~~~~~~~~~
In file included from ./include/linux/if_ether.h:19,
                 from ./include/uapi/linux/ethtool.h:19,
                 from ./include/linux/ethtool.h:18,
                 from ./include/linux/netdevice.h:37,
                 from /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.c:49:
./include/linux/skbuff.h:2255:21: note: previous definition of ‘skb_put_data’ was here
 2255 | static inline void *skb_put_data(struct sk_buff *skb, const void *data,
      |                     ^~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:286: /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module/hlcan.o] Error 1
make[1]: *** [Makefile:1785: /home/john/catkin_ws/src/flexa-robot/drivers/usb-can/src/module] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-63-generic'
make: *** [Makefile:11: all] Error 2
Building userpace tools
make: Nothing to be done for 'all'.

Commenting out lines 178 to 186 of ./src/module/hlcan.c (which was added in Pull Request 22) seems to solve the problem.

static inline void *skb_put_data(struct sk_buff *skb, const void *data,
                 unsigned int len)
{
    void *tmp = skb_put(skb, len);

    memcpy(tmp, data, len);

    return tmp;
}

I would like to know what are other solutions for this moving forward? Other than this, the tool works great. Thank you!

alexmohr commented 3 years ago

As I cannot build locally as well anymore after merging this PR I've reverted it for now as this was only relevant for a very special configuration. I'll see what I can do to fix this for both sides. Thanks for reporting.