axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.85k stars 402 forks source link

redefinition of 'struct in6_pktinfo' when building on ubi7 with gcc/g++ 9.5.0 #1187

Closed Rhett-Ying closed 2 weeks ago

Rhett-Ying commented 2 months ago

just run make -j

In file included from send-zerocopy.c:15:                                                                                    
/usr/include/linux/ipv6.h:19:8: error: redefinition of 'struct in6_pktinfo'                                
   19 | struct in6_pktinfo {                                                                                                 
      |        ^~~~~~~~~~~                                                                                                   
In file included from /usr/include/arpa/inet.h:22,                                                                           
                 from send-zerocopy.c:13:                                                                                    
/usr/include/netinet/in.h:538:8: note: originally defined here                                                               
  538 | struct in6_pktinfo                                                                                                   
      |        ^~~~~~~~~~~            
axboe commented 2 months ago

Don't think this is a liburing issue, none of those two headers are liburing.

Rhett-Ying commented 2 months ago

but this issue is hit when compiling the example code: https://github.com/axboe/liburing/blob/master/examples/send-zerocopy.c

And is there any way to build the src only. In default, src, examples, test are all built.

axboe commented 2 months ago

I realize it comes up when compiling that example, just saying that it isn't doing anything special or including odd headers. Does it compile if you remove linux/ipv6.h from that example?

You can compile just src using normal make parameters:

make -C src/
isilence commented 2 months ago

You can compile just src using normal make parameters:

make -C src/

We need to add a test-less target in the root makefile. For example, make -C will fail to run configure, so you can't use it with a freshly cloned repo.

axboe commented 2 months ago

Yep agree, we do need a specific target that just builds the library parts, not examples or tests. Something ala:

diff --git a/Makefile b/Makefile
index d6d86355950e..e57a65be17c2 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ all:
    @$(MAKE) -C test
    @$(MAKE) -C examples

+library:
+   @$(MAKE) -C src
+
 .PHONY: all install default clean test
 .PHONY: FORCE cscope

should probably do it.