standalone-linux-io-tracer icon indicating copy to clipboard operation
standalone-linux-io-tracer copied to clipboard

ubuntu 20.04 compile incomplete definition of type 'struct folio'

Open boycechen opened this issue 1 year ago • 3 comments

@mariuszbarczak @robertbaldyga @micrakow @mmkayPL ### I build the source code on ubuntu 20.04 with kernel 5.15.0-60-generic, but it fails with error in 98% progress as follows:

[ 98%] [clang] Building BPF object: iotrace In file included from /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.c:12:

/root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:37: error: incomplete definition of type 'struct folio' struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:403:2: note: expanded from macro 'BPF_CORE_READ' ___type((src), a, ##VA_ARGS) __r;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:274:29: note: expanded from macro '___type' #define ___type(...) typeof(___arrow(VA_ARGS)) ^~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:272:23: note: expanded from macro '___arrow' #define ___arrow(...) ___apply(___arrow, ___narg(VA_ARGS))(VA_ARGS) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:223:25: note: expanded from macro '___concat' #define ___concat(a, b) a ## b ^ :64:1: note: expanded from here ___arrow2 ^ /usr/include/bpf/bpf_core_read.h:263:26: note: expanded from macro '___arrow2' #define ___arrow2(a, b) a->b ~^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:37: error: incomplete definition of type 'struct folio' struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ' BPF_CORE_READ_INTO(&__r, (src), a, ##VA_ARGS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:311:2: note: expanded from macro 'BPF_CORE_READ_INTO' ___core_read(bpf_core_read, bpf_core_read,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:302:2: note: expanded from macro '___core_read' ___apply(___core_read, ___empty(VA_ARGS))(fn, fn_ptr, dst,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:296:2: note: expanded from macro '___core_read0' ___read(fn, dst, ___type(src), src, a); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:277:59: note: expanded from macro '___read' read_fn((void )(dst), sizeof((dst)), &((src_type)(src))->accessor) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:206:79: note: expanded from macro 'bpf_core_read' bpf_probe_read_kernel(dst, sz, (const void *)__builtin_preserve_access_index(src)) ^~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:27: *error: initializing 'struct address_space ' with an expression of incompatible type 'void' struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:201:48: error: use of undeclared identifier 'PG_readahead' return BPF_CORE_READ(page, flags) & (1UL < PG_readahead); ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:20: error: incomplete definition of type 'struct folio' return NULL != BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:403:2: note: expanded from macro 'BPF_CORE_READ' ___type((src), a, ##VA_ARGS) __r;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:274:29: note: expanded from macro '___type' #define ___type(...) typeof(___arrow(VA_ARGS)) ^~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:272:23: note: expanded from macro '___arrow' #define ___arrow(...) ___apply(___arrow, ___narg(VA_ARGS))(VA_ARGS) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:223:25: note: expanded from macro '___concat' #define ___concat(a, b) a ## b ^ :79:1: note: expanded from here ___arrow2 ^ /usr/include/bpf/bpf_core_read.h:263:26: note: expanded from macro '___arrow2' #define ___arrow2(a, b) a->b ~^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:20: error: incomplete definition of type 'struct folio' return NULL != BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ' BPF_CORE_READ_INTO(&__r, (src), a, ##VA_ARGS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:311:2: note: expanded from macro 'BPF_CORE_READ_INTO' ___core_read(bpf_core_read, bpf_core_read,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:302:2: note: expanded from macro '___core_read' ___apply(___core_read, ___empty(VA_ARGS))(fn, fn_ptr, dst,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:296:2: note: expanded from macro '___core_read0' ___read(fn, dst, ___type(src), src, a); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:277:59: note: expanded from macro '___read' read_fn((void )(dst), sizeof((dst)), &((src_type)(src))->accessor) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:206:79: note: expanded from macro 'bpf_core_read' bpf_probe_read_kernel(dst, sz, (const void *)__builtin_preserve_access_index(src)) ^~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:17: *error: invalid operands to binary expression ('void ' and 'void') return NULL != BPF_CORE_READ(folio, mapping); ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 errors generated. make[3]: *** [source/iotrace/CMakeFiles/iotrace.dir/build.make:74: source/iotrace/iotrace.bpf.o] Error 1 make[3]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make[2]: *** [CMakeFiles/Makefile2:2528: source/iotrace/CMakeFiles/iotrace.dir/all] Error 2 make[2]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make[1]: *** [Makefile:152: all] Error 2 make[1]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make: *** [Makefile:40: all] Error 2

How do I to fix the compile issue ?

boycechen avatar Jul 24 '23 13:07 boycechen

I have this probolem,too

zwbrealm avatar Dec 07 '23 15:12 zwbrealm

Hi Guys, the main branch is dedicated to work with newer kernels and eBPF. Could you try this branch: master-kernel (https://github.com/Open-CAS/standalone-linux-io-tracer/tree/master-kernel). It sill uses kernel module to collect fetch io traces.

mariuszbarczak avatar Dec 08 '23 09:12 mariuszbarczak

@zwbrealm The fix is coming. You can check if this solve your problem,

mariuszbarczak avatar Apr 17 '24 20:04 mariuszbarczak

Fix integrated to the main

mariuszbarczak avatar May 17 '24 19:05 mariuszbarczak