radareorg/r2ghidra

Issues with interface with radare2?

Closed this issue · 7 comments

Vbbab commented

I'm currently trying to build r2ghidra in a radare/radare2 docker container, which comes with radare2 5.4.0-git pre-installed. However, following the steps in the README sequentially for building, once I run make, a bunch of compiler errors spew out:

c++ -fPIC -I../third-party/pugixml/src/ -g -std=c++11 -DR2GHIDRA_SLEIGHHOME_DEFAULT=\"/home/r2/.local/share/radare2/plugins/r2ghidra_sleigh\" -w -fPIC -Wshadow -I../ghidra-native/src/decompiler -I. -I/usr/local/include/libr -I/usr/local/include/libr/sdb -I/usr/local/include/libr -I/usr/local/include/libr/sdb -c R2LoadImage.cpp
R2LoadImage.cpp: In member function 'virtual void R2LoadImage::getReadonly(RangeList&) const':
R2LoadImage.cpp:43:5: error: 'RIOMapRef' was not declared in this scope
     RIOMapRef *mapref;
     ^~~~~~~~~
R2LoadImage.cpp:43:5: note: suggested alternative: 'RIOMapGet'
     RIOMapRef *mapref;
     ^~~~~~~~~
     RIOMapGet
R2LoadImage.cpp:43:16: error: 'mapref' was not declared in this scope
     RIOMapRef *mapref;
                ^~~~~~
R2LoadImage.cpp:43:16: note: suggested alternative: '_fpreg'
     RIOMapRef *mapref;
                ^~~~~~
                _fpreg
R2LoadImage.cpp:46:5: error: 'RIOBank' was not declared in this scope
     RIOBank *bank = r_io_bank_get (io, io->bank);
     ^~~~~~~
R2LoadImage.cpp:46:5: note: suggested alternative: 'RIOBind'
     RIOBank *bank = r_io_bank_get (io, io->bank);
     ^~~~~~~
     RIOBind
 
# ... More errors were omitted ...

Based on the fact that all of these appear to be issues with the code using nonexistent stuff, my best guess as to the cause of the error is that radare2 has updated its development libraries, and so no longer supports building r2ghidra.

I have also tried to build this on an Ubuntu 20.04 machine, as well as to install r2ghidra via r2pm. Neither of these have worked, and they have all failed with similar "not declared..." errors.

Still, I can see that this repo seems to be recently updated, so I was just wondering if this was an active issue or if I should investigate my system configuration. Could someone please help point me in a potential direction?

Thanks!

trufae commented

R2-5.4 is too old. I removed support for this version a while ago. I keep abi changes suppport via ifdefs for a while, but when things get too hard to maintain i just drop this.

I may check how this docker image is made and published and make it happen in the release process in the ci.

please use a newer version. You can wget the deb packages from the release page

trufae commented

i just got control over this docker. hope to find some time during the weekend to setup the CI, so the next release (in a week) will be shipped automatically

Vbbab commented

Oh, I see. Thanks!

(Funnily enough I think the latest version of r2 on Ubuntu focal apt is 4.2, which must be ancient then 😅)

I'll close this, then. Thanks for the help!

trufae commented

If you run make -C dist/docker you can build the image for testing. (in the radare2 repo)

Vbbab commented

Alright. Thank you!

trufae commented

you are good to go now. the image has been updated with latest r2 from git inside. but you can also rebuild it with the pkgs or version you like. i'll add timeless r2pm packaging soon too. so it will be possible to build r2ghidra r2dec or any other plugin at the given timestamp.

thanks for the heads up on the dockerhub i wasnt aware that thing even existed :D

Vbbab commented

Alright, thank you so much! 🙏