r2pm -ci r2ghidra 时报错:checking pkg-config flags for r_core... no

参考网址:

sys/python.sh fails with `checking pkg-config flags for r_core... no` · Issue #1943 · radareorg/radare2 · GitHub

进入目录/root/.local/share/radare2/r2pm/git/r2ghidra查看configure文件,查找报错位置

 执行指令 :

# pkg-config --cflags r_core           
Package libxxhash was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxxhash.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found
Package 'libxxhash', required by 'r_hash', not found

安装 libxxhash

apt-get install libxxhash-dev

最后进行:r2pm -ci r2ghidra 进行安装时还是报错:

anal_ghidra_plugin.c:28:10: error: ‘RAnalPlugin’ {aka ‘struct r_anal_plugin_t’} has no member named ‘cpus’
   28 |         .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
      |          ^~~~
anal_ghidra_plugin.c:28:17: error: initializer element is not computable at load time
   28 |         .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anal_ghidra_plugin.c:28:17: note: (near initialization for ‘r_anal_plugin_ghidra.bits’)
gmake: *** [<builtin>: anal_ghidra_plugin.o] Error 1
gmake: Leaving directory '/root/.local/share/radare2/r2pm/git/r2ghidra/src'
ERROR make

pdg反编译指令暂时搞不定。

安装r2dec插件,使用pdd反编译

r2pm install r2dec

[0x08048430]> pdd @main
/* r2dec pseudo code output */
/* /root/test/ret2win32 @ 0x8048546 */
#include <stdint.h>
 
int32_t main (char ** argv) {
    int32_t var_4h;
    ecx = &argv;
    eax = stdout;
    setvbuf (eax, 0, 2, 0);
    puts ("ret2win by ROP Emporium");
    puts ("x86\n");
    pwnme ();
    puts ("\nExiting");
    eax = 0;
    ecx = var_4h;
    esp = ecx - 4;
    return eax;
}

终于有时间了接着安装r2ghidra插件,接着上面报错:

 找到r2ghidra的默认的路径:~/.local/share/radare2/r2pm/git/r2ghidra

在./src路径下找到anal_ghidra_plugin.c文件,按照“has no member named”报错,找到一篇文档:C语言,C++编译遇到问题:has no member named ''XXX‘_ZDF19的博客-CSDN博客

文档中找到的两个方法都没有用,还要自己进行解决,估计是“cpus”没有定义,查看源文件

 27  #if R2_VERSION_NUMBER >= 50609
    28          .endian = R_SYS_ENDIAN_LITTLE | R_SYS_ENDIAN_BIG,
    29 #endif
    30          .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
    31 

查看当前系统的r2版本

 r2 -V
5.5.0  r2
5.5.0  r_anal
5.5.0  r_lib
5.5.0  r_egg
5.5.0  r_asm
5.5.0  r_bin
5.5.0  r_cons
5.5.0  r_flag
5.5.0  r_core

应该是大于50609

把29行的#endif下移如下,搞定

 27  #if R2_VERSION_NUMBER >= 50609
    28          .endian = R_SYS_ENDIAN_LITTLE | R_SYS_ENDIAN_BIG,
    29
    30          .cpus = "6502,6805,8051,arm,avr,cr16,dalvik,hppa,java,m68k,m8c,mips,mcs96,msp430,pic24,ppc,sh,sparc,stm8,tricore,toy,v850,wasm,x86,z80",
    31  #endif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值