Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r2pm -i bpf fails: struct r_bin_plugin_t’ has no member named ‘load’` #200

Open
WGH- opened this issue Jul 20, 2019 · 4 comments
Open

Comments

@WGH-
Copy link

WGH- commented Jul 20, 2019

$ radare2 --version
radare2: invalid option -- '-'
radare2 3.6.0 0 @ linux-x86-64 git.3.6.0
commit: HEAD build: 2019-06-25__17:22:11
$ r2pm -v       
r2pm 3.6.0
$ r2pm -i bpf
Already up to date.
Install Done For bpf
rm -f *.so
rm -rf *.so.dSYM
cc -g -fPIC -I/usr/include/libr -shared -L/usr/lib64 -lr_util -lr_parse -lr_syscall -lr_asm -lr_lang -lr_parse -lr_syscall -lr_flag -lr_cons -lr_reg -lr_util -ldl -o asm_bpf.so asm_bpf.c
cc -g -fPIC -I/usr/include/libr -shared -L/usr/lib64 -lr_util -lr_parse -lr_syscall -lr_anal -lr_reg -lr_syscall -lr_search -lr_cons -lr_flag -lr_crypto -lr_hash -lr_util -ldl -o anal_bpf.so anal_bpf.c
anal_bpf.c:502:8: warning: initialization of ‘int (*)(RAnal *, RAnalOp *, long long unsigned int,  const unsigned char *, int,  RAnalOpMask)’ {aka ‘int (*)(struct r_anal_t *, struct r_anal_op_t *, long long unsigned int,  const unsigned char *, int,  enum <anonymous>)’} from incompatible pointer type ‘int (*)(RAnal *, RAnalOp *, long long unsigned int,  const unsigned char *, int)’ {aka ‘int (*)(struct r_anal_t *, struct r_anal_op_t *, long long unsigned int,  const unsigned char *, int)’} [-Wincompatible-pointer-types]
  .op = &bpf_anal,
        ^
anal_bpf.c:502:8: note: (near initialization for ‘r_anal_plugin_bpf.op’)
cc -g -fPIC -I/usr/include/libr -shared -L/usr/lib64 -lr_util -lr_parse -lr_syscall -lr_bin -lr_io -lr_socket -lr_magic -lr_util -ldl -lr_magic -o bin_bpf.so bin_bpf.c
bin_bpf.c:71:3: error: ‘struct r_bin_plugin_t’ has no member named ‘load’
  .load = &load,
   ^~~~
bin_bpf.c:71:10: warning: initialization of ‘_Bool (*)(RBinFile *, void **, RBuffer *, long long unsigned int,  Sdb *)’ {aka ‘_Bool (*)(struct r_bin_file_t *, void **, struct r_buf_t *, long long unsigned int,  struct sdb_t *)’} from incompatible pointer type ‘_Bool (*)(RBinFile *)’ {aka ‘_Bool (*)(struct r_bin_file_t *)’} [-Wincompatible-pointer-types]
  .load = &load,
          ^
bin_bpf.c:71:10: note: (near initialization for ‘r_bin_plugin_bpf.load_buffer’)
bin_bpf.c:72:3: error: ‘struct r_bin_plugin_t’ has no member named ‘load_bytes’; did you mean ‘load_buffer’?
  .load_bytes = NULL,
   ^~~~~~~~~~
   load_buffer
bin_bpf.c:73:13: warning: initialization of ‘void (*)(RBinFile *)’ {aka ‘void (*)(struct r_bin_file_t *)’} from incompatible pointer type ‘int (*)(RBinFile *)’ {aka ‘int (*)(struct r_bin_file_t *)’} [-Wincompatible-pointer-types]
  .destroy = &destroy,
             ^
bin_bpf.c:73:13: note: (near initialization for ‘r_bin_plugin_bpf.destroy’)
gmake: *** [Makefile:20: all] Error 1
@WGH-
Copy link
Author

WGH- commented Jul 20, 2019

There's a different error on Radare v2.3 (found on Ubuntu 18.04 LTS):

$ r2pm  -i bpf
Already up to date.
Install Done For bpf
rm -f *.so
rm -rf *.so.dSYM
cc -g -fPIC -I/usr/include/libr -shared -L/usr/lib/x86_64-linux-gnu -lr_util -lr_parse -lr_syscall -lr_asm -lr_lang -lr_parse -lr_syscall -lr_flag -lr_cons -lr_reg -lr_util -lz -lzip -ldl -o asm_bpf.so asm_bpf.c
asm_bpf.c: In function 'disassemble':
asm_bpf.c:239:18: warning: passing argument 1 of 'r_strbuf_setf' from incompatible pointer type [-Wincompatible-pointer-types]
   r_strbuf_setf (&r_op->buf_asm, "%s %s, 0x%08" PFMT64x ", 0x%08" PFMT64x "", op, vbuf,
                  ^
In file included from /usr/include/libr/r_util.h:57:0,
                 from asm_bpf.c:10:
/usr/include/libr/r_util/r_strbuf.h:18:12: note: expected 'RStrBuf * {aka struct <anonymous> *}' but argument is of type 'char (*)[256]'
 R_API bool r_strbuf_setf(RStrBuf *sb, const char *fmt, ...);
            ^~~~~~~~~~~~~
asm_bpf.c:241:22: warning: passing argument 1 of 'r_strbuf_setf' from incompatible pointer type [-Wincompatible-pointer-types]
  else r_strbuf_setf (&r_op->buf_asm, "%s %s", op, vbuf);
                      ^
In file included from /usr/include/libr/r_util.h:57:0,
                 from asm_bpf.c:10:
/usr/include/libr/r_util/r_strbuf.h:18:12: note: expected 'RStrBuf * {aka struct <anonymous> *}' but argument is of type 'char (*)[256]'
 R_API bool r_strbuf_setf(RStrBuf *sb, const char *fmt, ...);
            ^~~~~~~~~~~~~
asm_bpf.c: In function 'assemble_tok':
asm_bpf.c:251:2: warning: implicit declaration of function 'r_strbuf_setbin'; did you mean 'r_strbuf_setf'? [-Wimplicit-function-declaration]
  r_strbuf_setbin (&a, (const ut8 *)b, sizeof (*b) + 1);\
  ^
asm_bpf.c:588:3: note: in expansion of macro 'COPY_AND_RET'
   COPY_AND_RET (op->buf, &f);
   ^~~~~~~~~~~~
asm_bpf.c: In function 'assemble':
asm_bpf.c:700:16: warning: passing argument 1 of 'r_strbuf_set' from incompatible pointer type [-Wincompatible-pointer-types]
  r_strbuf_set (&op->buf_asm, buf);
                ^
In file included from /usr/include/libr/r_util.h:57:0,
                 from asm_bpf.c:10:
/usr/include/libr/r_util/r_strbuf.h:17:12: note: expected 'RStrBuf * {aka struct <anonymous> *}' but argument is of type 'char (*)[256]'
 R_API bool r_strbuf_set(RStrBuf *sb, const char *s);
            ^~~~~~~~~~~~
asm_bpf.c:701:13: warning: passing argument 1 of 'normalize' from incompatible pointer type [-Wincompatible-pointer-types]
  normalize (&op->buf_asm);
             ^
asm_bpf.c:661:13: note: expected 'RStrBuf * {aka struct <anonymous> *}' but argument is of type 'char (*)[256]'
 static void normalize(RStrBuf *buf) {
             ^~~~~~~~~
asm_bpf.c:705:20: warning: passing argument 1 of 'r_strbuf_get' from incompatible pointer type [-Wincompatible-pointer-types]
  p = r_strbuf_get (&op->buf_asm);
                    ^
In file included from /usr/include/libr/r_util.h:57:0,
                 from asm_bpf.c:10:
/usr/include/libr/r_util/r_strbuf.h:22:13: note: expected 'RStrBuf * {aka struct <anonymous> *}' but argument is of type 'char (*)[256]'
 R_API char *r_strbuf_get(RStrBuf *sb);
             ^~~~~~~~~~~~
cc -g -fPIC -I/usr/include/libr -shared -L/usr/lib/x86_64-linux-gnu -lr_util -lr_parse -lr_syscall -lr_anal -lr_reg -lr_syscall -lr_search -lr_cons -lr_flag -lr_util -lz -lzip -ldl -o anal_bpf.so anal_bpf.c
anal_bpf.c:49:1: error: unknown type name 'RAnalEsilInterruptHandler'; did you mean 'RAnalEsilInterruptCB'?
 RAnalEsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
 ^~~~~~~~~~~~~~~~~~~~~~~~~
 RAnalEsilInterruptCB
anal_bpf.c:49:37: warning: excess elements in scalar initializer
 RAnalEsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
                                     ^~~~
anal_bpf.c:49:37: note: (near initialization for 'ih')
anal_bpf.c:49:43: warning: excess elements in scalar initializer
 RAnalEsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
                                           ^~~~
anal_bpf.c:49:43: note: (near initialization for 'ih')
anal_bpf.c:49:49: warning: excess elements in scalar initializer
 RAnalEsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
                                                 ^
anal_bpf.c:49:49: note: (near initialization for 'ih')
anal_bpf.c:49:64: warning: excess elements in scalar initializer
 RAnalEsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
                                                                ^~~~
anal_bpf.c:49:64: note: (near initialization for 'ih')
anal_bpf.c: In function 'bpf_anal':
anal_bpf.c:86:3: warning: implicit declaration of function 'esilprintf'; did you mean 'vswprintf'? [-Wimplicit-function-declaration]
   esilprintf (op, "A,R0,=,0,$");
   ^~~~~~~~~~
   vswprintf
anal_bpf.c: In function 'esil_bpf_init':
anal_bpf.c:482:2: error: unknown type name 'RAnalEsilInterrupt'; did you mean 'RAnalEsilInterruptCB'?
  RAnalEsilInterrupt *intr = r_anal_esil_interrupt_new (esil, 0, &ih);
  ^~~~~~~~~~~~~~~~~~
  RAnalEsilInterruptCB
anal_bpf.c:482:29: warning: implicit declaration of function 'r_anal_esil_interrupt_new'; did you mean 'r_anal_esil_set_interrupt'? [-Wimplicit-function-declaration]
  RAnalEsilInterrupt *intr = r_anal_esil_interrupt_new (esil, 0, &ih);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~
                             r_anal_esil_set_interrupt
anal_bpf.c:482:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
anal_bpf.c:483:35: warning: passing argument 2 of 'r_anal_esil_set_interrupt' makes integer from pointer without a cast [-Wint-conversion]
  r_anal_esil_set_interrupt (esil, intr);
                                   ^~~~
In file included from /usr/include/libr/r_parse.h:8:0,
                 from /usr/include/libr/r_asm.h:9,
                 from anal_bpf.c:10:
/usr/include/libr/r_anal.h:1302:11: note: expected 'int' but argument is of type 'int *'
 R_API int r_anal_esil_set_interrupt (RAnalEsil *esil, int interrupt, RAnalEsilInterruptCB interruptcb);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
anal_bpf.c:483:2: error: too few arguments to function 'r_anal_esil_set_interrupt'
  r_anal_esil_set_interrupt (esil, intr);
  ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/libr/r_parse.h:8:0,
                 from /usr/include/libr/r_asm.h:9,
                 from anal_bpf.c:10:
/usr/include/libr/r_anal.h:1302:11: note: declared here
 R_API int r_anal_esil_set_interrupt (RAnalEsil *esil, int interrupt, RAnalEsilInterruptCB interruptcb);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:18: recipe for target 'all' failed
make: *** [all] Error 1

@radare
Copy link
Collaborator

radare commented Jul 20, 2019 via email

@WGH-
Copy link
Author

WGH- commented Jul 20, 2019

What r2 version?

@radare
Copy link
Collaborator

radare commented Jul 20, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants