wargio / r2dec-js

radare2 plugin - converts asm to pseudo-C code.
508 stars 48 forks source link

M1 Macbook(2020) r2pm install r2dec can't run #275

Closed skpersonal closed 2 years ago

skpersonal commented 2 years ago

machine: M1 Macbook(2020)

When running "r2pm install r2dec", two errors occured and install is stopped.

Output:

Updating b4e75c0..f580198
Fast-forward
 db/muon    |  7 ++++---
 db/samurai | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 db/samurai
[r2pm] Updating package database /Users/skper/.local/share/radare2/r2pm/db ...
Already up to date.
Already on 'master'
Your branch is up to date with 'origin/master'.
Already up to date.
error: pathspec 'r2-5.6.8' did not match any file(s) known to git
Already up to date.
Install Done For r2dec
make build
[CC] core_pdd.o
core_pdd.c:133:19: error: implicit declaration of function 'r2dec_jsc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        const char *js = r2dec_jsc(fullname);
                         ^
core_pdd.c:133:14: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
        const char *js = r2dec_jsc(fullname);
                    ^    ~~~~~~~~~~~~~~~~~~~
core_pdd.c:181:19: error: implicit declaration of function 'r2dec_jsc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        const char *js = r2dec_jsc(file);
                         ^
core_pdd.c:181:14: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
        const char *js = r2dec_jsc(file);
                    ^    ~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
make[1]: *** [core_pdd.o] Error 1
make: *** [all] Error 2
trufae commented 2 years ago

This is fixed with export PYTHON=python3

Screenshot 2022-05-31 at 04 11 44
skpersonal commented 2 years ago

Thank you! @trufae

trufae commented 2 years ago

Ive improved r2pm to find different versions of python in path and set the environment accordingly. Next r2-5.7.2 will ship this trick, but for now i think it's fine to just set the eng or symlink your python3 binary as python in the PATH