radareorg/r2ghidra

‘R_ARCH_INFO_MIN_OP_SIZE’ was not declared in this scope (Error at ArchMap.cpp:242:14)

Closed this issue · 4 comments

Hi, I tried to install r2ghidra in Kali Linux 2023.1 and I got this error:

┌──(hokum㉿kali)-[~]
└─$ r2pm -ci r2ghidra
Cleaning r2ghidra...
DEPENDS: r2ghidra-sleigh
Sat Aug 12 05:51:52 PM WIB 2023
clean Done For r2ghidra
/home/hokum/.local/share/radare2/r2pm/db/r2ghidra TGZ=
Cleaning up /home/hokum/.local/share/radare2/r2pm/git/r2ghidra...
HEAD is now at 4f9f2b0 add capstone packages
Updating 4f9f2b0..96c858f
Fast-forward
db/capstone-v4 | 8 +++++---
db/capstone-v5 | 9 ++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
[r2pm] Updating package database /home/hokum/.local/share/radare2/r2pm/db ...
Already up to date.
error: pathspec 'r2-5.5.0' did not match any file(s) known to git
Already up to date.
DEPENDS: r2ghidra-sleigh
Sat Aug 12 05:51:52 PM WIB 2023
Install Done For r2ghidra
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 '/usr/local'
checking for c++ compiler... c++
checking for cpp... cpp
checking for git... /usr/bin/git
checking for pkg-config... /usr/bin/pkg-config
Using PKGCONFIG: /usr/bin/pkg-config
checking pkg-config flags for r_core... yes
checking pkg-config flags for r_asm... yes
checking pkg-config flags for r_anal... yes
checking for r2... /usr/bin/r2
checking for bison... no
checking for flex... /usr/bin/flex
checking exec r2 -H R2_PREFIX... ok
checking exec r2 -H R2_USER_PLUGINS... ok
checking exec r2 -H R2_LIBR_PLUGINS... ok
creating config.mk
creating Makefile
cleaning temporally files... done

Final report:

  • VERSION = 5.8.8
  • R2_PREFIX = /usr
  • PREFIX = /usr/local
  • PKGCONFIG = /usr/bin/pkg-config
    git clone https://github.com/radareorg/ghidra-native
    Cloning into 'ghidra-native'...
    remote: Enumerating objects: 3087, done.
    remote: Counting objects: 100% (882/882), done.
    remote: Compressing objects: 100% (660/660), done.
    remote: Total 3087 (delta 275), reused 465 (delta 170), pack-reused 2205
    Receiving objects: 100% (3087/3087), 6.12 MiB | 3.59 MiB/s, done.
    Resolving deltas: 100% (1191/1191), done.
    cd ghidra-native && git checkout 0.3.3
    Note: switching to '0.3.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 28b0608 Release 0.3.3 with an exploitable bug fix included
gmake -C ghidra-native patch
gmake[1]: Entering directory '/home/hokum/.local/share/radare2/r2pm/git/r2ghidra/ghidra-native'
for a in patches/0001-space-after-comma.patch patches/0002-make-sleigharch-public.patch patches/0004-public-fields.patch patches/00067-readonly-warning.patch patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch patches/0023-Undef-LoadImage-for-windows.patch patches/0024-ignore-symbol-beyond-space.patch patches/0044-bad-unicode-codepoint.patch patches/0055-datatype-clone.patch patches/0056-nullderef-workaround.patch patches/0080-getparent-flow.patch patches/0090-nocasts-warnings.patch patches/0091-decompiler-xml-packer.patch patches/0092-badvar-segfault.patch ; do echo "patch -p1 < $a" ; patch -p1 < $a ; done
patch -p1 < patches/0001-space-after-comma.patch
patching file src/decompiler/printc.cc
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 82 with fuzz 1.
patch -p1 < patches/0002-make-sleigharch-public.patch
patching file src/decompiler/sleigh_arch.hh
patch -p1 < patches/0004-public-fields.patch
patching file src/decompiler/context.hh
Hunk #1 succeeded at 94 with fuzz 2 (offset 5 lines).
patching file src/decompiler/sleigh.hh
Hunk #1 succeeded at 170 (offset 4 lines).
patch -p1 < patches/00067-readonly-warning.patch
patching file src/decompiler/funcdata_varnode.cc
Hunk #1 succeeded at 518 (offset 2 lines).
Hunk #2 succeeded at 537 (offset 2 lines).
patch -p1 < patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch
patching file src/decompiler/xml.cc
Hunk #1 succeeded at 101 with fuzz 2 (offset 3 lines).
patching file src/decompiler/xml.hh
Hunk #1 succeeded at 36 with fuzz 2 (offset 9 lines).
Hunk #2 succeeded at 44 (offset 9 lines).
patch -p1 < patches/0023-Undef-LoadImage-for-windows.patch
patching file src/decompiler/loadimage.hh
Hunk #1 succeeded at 23 with fuzz 2 (offset 2 lines).
patch -p1 < patches/0024-ignore-symbol-beyond-space.patch
patching file src/decompiler/database.cc
Hunk #1 succeeded at 1857 (offset 52 lines).
patch -p1 < patches/0044-bad-unicode-codepoint.patch
patching file src/decompiler/stringmanage.cc
Hunk #1 succeeded at 48 (offset 8 lines).
patch -p1 < patches/0055-datatype-clone.patch
patching file src/decompiler/type.hh
patch -p1 < patches/0056-nullderef-workaround.patch
patching file src/decompiler/merge.hh
patch -p1 < patches/0080-getparent-flow.patch
patching file src/decompiler/flow.cc
Hunk #1 succeeded at 994 (offset -12 lines).
patch -p1 < patches/0090-nocasts-warnings.patch
patching file src/decompiler/printc.cc
Hunk #1 succeeded at 3248 (offset 153 lines).
Hunk #2 succeeded at 3257 (offset 153 lines).
patch -p1 < patches/0091-decompiler-xml-packer.patch
patching file src/decompiler/prettyprint.cc
patch -p1 < patches/0092-badvar-segfault.patch
patching file src/decompiler/varmap.cc
patching file src/decompiler/database.cc
touch patch.done
gmake[1]: Leaving directory '/home/hokum/.local/share/radare2/r2pm/git/r2ghidra/ghidra-native'
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 '/usr'
checking for c++ compiler... c++
checking for cpp... cpp
checking for git... /usr/bin/git
checking for pkg-config... /usr/bin/pkg-config
Using PKGCONFIG: /usr/bin/pkg-config
checking pkg-config flags for r_core... yes
checking pkg-config flags for r_asm... yes
checking pkg-config flags for r_anal... yes
checking for r2... /usr/bin/r2
checking for bison... no
checking for flex... /usr/bin/flex
checking exec r2 -H R2_PREFIX... ok
checking exec r2 -H R2_USER_PLUGINS... ok
checking exec r2 -H R2_LIBR_PLUGINS... ok
creating config.mk
creating Makefile
cleaning temporally files... done

Final report:

  • VERSION = 5.8.8
  • R2_PREFIX = /usr
  • PREFIX = /usr
  • PKGCONFIG = /usr/bin/pkg-config
    gmake: Entering directory '/home/hokum/.local/share/radare2/r2pm/git/r2ghidra/src'
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c R2Architecture.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c R2LoadImage.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c R2Scope.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c R2TypeFactory.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c R2CommentDatabase.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c CodeXMLParse.cpp
    c++ -fPIC -I../third-party/pugixml/src/ -g -ggdb -std=c++11 -I/home/hokum/.local/share/radare2/prefix/include -DR2GHIDRA_SLEIGHHOME_DEFAULT="/home/hokum/.local/share/radare2/plugins/r2ghidra_sleigh" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -g -ggdb -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -c ArchMap.cpp
    ArchMap.cpp: In function ‘int ai(RCore*, std::string, int)’:
    ArchMap.cpp:242:14: error: ‘R_ARCH_INFO_MIN_OP_SIZE’ was not declared in this scope; did you mean ‘R_ANAL_ARCHINFO_MIN_OP_SIZE’?
    242 | case R_ARCH_INFO_MIN_OP_SIZE:
    | ^~~~~~~~~~~~~~~~~~~~~~~
    | R_ANAL_ARCHINFO_MIN_OP_SIZE
    ArchMap.cpp:244:14: error: ‘R_ARCH_INFO_MAX_OP_SIZE’ was not declared in this scope; did you mean ‘R_ANAL_ARCHINFO_MAX_OP_SIZE’?
    244 | case R_ARCH_INFO_MAX_OP_SIZE:
    | ^~~~~~~~~~~~~~~~~~~~~~~
    | R_ANAL_ARCHINFO_MAX_OP_SIZE
    gmake: *** [Makefile:97: ArchMap.o] Error 1
    gmake: Leaving directory '/home/hokum/.local/share/radare2/r2pm/git/r2ghidra/src'
    ERROR: make

What should I do?

radare commented

What version of r2 is kali shipping because iirc its 3 years old

Sorry for the very late reply, currently it's version 5.0.0 in Kali 2023.1

trufae commented

Yes this is 3 years old. I dont maintain api compat for more than 1-2 years. Just update r2 and everything will work fine

Yes this is 3 years old. I dont maintain api compat for more than 1-2 years. Just update r2 and everything will work fine

Yes, I updated it. Now, it works. Thanks