radareorg / radare2-bindings

Bindings of the r2 api for Valabind and friends
GNU Lesser General Public License v3.0
130 stars 92 forks source link

unable to install lang-python package with r2pm #224

Closed SiriK404 closed 4 years ago

SiriK404 commented 4 years ago

while installing i get the following error : Install Done For lang-python ==> Using valabind ./configure: 9: ./configure.hook: valabind: not found ==> Using swig ./configure: 11: ./configure.hook: swig: not found Checking valabind languages support... WARNING: cannot find valabind

Final report:

radare commented 4 years ago

You need to install valabind and swig

I thibk the problem isbthat the pkgdb is old and is not pointing to the new repos

On 4 Nov 2019, at 06:46, Jiraya-sama notifications@github.com wrote:

 while installing i get the following error : Install Done For lang-python ==> Using valabind ./configure: 9: ./configure.hook: valabind: not found ==> Using swig ./configure: 11: ./configure.hook: swig: not found Checking valabind languages support... WARNING: cannot find valabind

gir: no cxx: yes (g++) valac: no Supported langs: cxx duktape checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for working directories... current using prefix '/root/.local/share/radare2/prefix' checking for c compiler... gcc checking for c++ compiler... g++ checking for valabind... no checking for swig... no checking for g-ir-compiler... no Using PKGCONFIG: pkg-config checking pkg-config flags for r_core... yes creating ./config.mk cleaning temporally files... done Final report:

PREFIX = /root/.local/share/radare2/prefix HAVE_SWIG = 0 HAVE_VALABIND = 0 HAVE_GIRCOMPILER = 0 make: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' rm -f python.o lang_python.so make: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' make: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' rm -f lang_python.so make lang_python.so make[1]: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' cc python.c python/.c -I/root/.local/share/radare2/prefix/include -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -DPREFIX="/root/.local/share/radare2/prefix" -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -DPREFIX="/root/.local/share/radare2/prefix" -I/usr/include/python3.7m -I/usr/include/python3.7m -Wno-unused-result -Wsign-compare -g -fdebug-prefix-map=/build/python3.7-rR9CoL/python3.7-3.7.3~rc1=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -DPYVER=3 -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -L/usr/lib -lr_core -lr_io -lr_util -shared -lr_asm -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -lr_core -lcapstone -lr_config -lr_debug -lr_bin -lr_anal -lr_bp -lr_egg -lr_asm -lr_lang -lr_parse -lr_flag -lr_reg -lr_search -lr_syscall -lr_fs -lr_io -lr_socket -lr_magic -lmagic -lr_crypto -lr_hash -lxxhash -lr_cons -lr_util -lz -lzip -ldl -L/root/.local/share/radare2/prefix/lib -lr_core -lr_io -lr_util -shared -lr_asm -fPIC -o lang_python.so python/anal.c: In function ‘Radare_plugin_anal’: python/anal.c:253:10: warning: assignment to ‘RAnalOpCallback’ {aka ‘int ()(struct r_anal_t , struct r_anal_op_t , long long unsigned int, const unsigned char , int)’} from incompatible pointer type ‘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 )’} [-Wincompatible-pointer-types] ap->op = py_anal; ^ python/bin.c: In function ‘create_PyBinFile’: python/bin.c:165:23: warning: implicit declaration of function ‘r_buf_data’; did you mean ‘r_buf_dump’? [-Wimplicit-function-declaration] const ut8 buf_ptr = r_buf_data (binfile->buf, &buf_size); ^~~~~~ r_buf_dump python/bin.c:165:23: warning: initialization of ‘const unsigned char ’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] python/bin.c: In function ‘py_load_buffer’: python/bin.c:318:24: warning: initialization of ‘const unsigned char ’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] const ut8 buf_data = r_buf_data (buf, &size); ^~~~~~ python/bin.c: In function ‘Radare_plugin_bin’: python/bin.c:725:19: warning: assignment to ‘void ()(RBinFile , RBuffer , long long unsigned int, Sdb )’ {aka ‘void ()(struct r_bin_file_t , struct r_buf_t , long long unsigned int, struct sdb_t )’} from incompatible pointer type ‘_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 )’} [-Wincompatible-pointer-types] bp->load_buffer = py_load_buffer; ^ python/bin.c:731:15: warning: assignment to ‘int ()(RBinFile )’ {aka ‘int ()(struct r_bin_file_t )’} from incompatible pointer type ‘void ()(RBinFile )’ {aka ‘void ()(struct r_bin_file_t )’} [-Wincompatible-pointer-types] bp->destroy = py_destroy; ^ At top level: python/bin.c:295:13: warning: ‘py_load’ defined but not used [-Wunused-function] static bool py_load(RBinFile *arch) { ^~~ python/io.c: In function ‘py_io_open’: python/io.c:16:7: warning: variable ‘fd’ set but not used [-Wunused-but-set-variable] int fd = -1; ^~ /usr/bin/ld: cannot find -lxxhash /usr/bin/ld: cannot find -lz /usr/bin/ld: cannot find -lzip collect2: error: ld returned 1 exit status make[1]: [Makefile:82: lang_python.so] Error 1 make[1]: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' make: [Makefile:89: py] Error 2 make: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

SiriK404 commented 4 years ago

i have installed all the necessary libraries and valabind and swig. Post that when i install lang-python i get:

r2pm -i lang-python

Module version mismatch /root/.local/share/radare2/plugins/lang_python.so (3.1.2) vs (3.9) Already up to date. Install Done For lang-python ==> Using valabind ?-1.7.0 ==> Using swig 3.0.12 Checking valabind languages support... WARNING: cannot find valabind

Final report:

It creates a lang-python.so but when i try to import it within a plugin it says module not found.Please help with this.I think its a path issue i dont know how to fix it.

SiriK404 commented 4 years ago

Also when i go to r2 console: [0x00000000]> #! c: (LGPL) C language extension cpipe: (LGPL) r2pipe scripting in C vala: (LGPL) Vala language extension rust: (MIT) Rust language extension zig: (MIT) Zig language extension pipe: (LGPL) Use #!pipe node script.js lib: (LGPL) Load libs directly into r2 [0x00000000]>

XVilka commented 4 years ago

In my opinion, lang-python should be decoupled from the radare2-bindings repo, since it's the most commonly installed plugin anyway, will reduce the installation time and remove the need for all these deps. It will be possible to simplify the building as well. Probably duktape too, but that's it. There is a less interest for everything else. @radare @thestr4ng3r @ITAYC0HEN @xarkes what do you think?

SiriK404 commented 4 years ago

i am using a fresh kali image this time 2019.1 and post installation on lang-python when i try to import it using r2 i get: r2: symbol lookup error: /root/.local/share/radare2/plugins/lang_python.so: undefined symbol: r_buf_data

To resolve this error i installed r2 again using apt but then i get module version mismatch error and r2lang is not found...

XVilka commented 4 years ago

@Jiraya-sama show the output of r2 -version. I think you have too old radare2.

SiriK404 commented 4 years ago

r2 -version

radare2 3.1.2 0 @ linux-x86-64 git.3.1.2 commit: HEAD build: 2018-12-11__11:34:51

i updated r2 using apt install....but then i get module version mismatch with lang-python

XVilka commented 4 years ago

Way too old. Remove the distribution one and install from the sources.

XVilka commented 4 years ago

Once you installed, you can just clone https://github.com/radareorg/radare2-rlang and run "make".