radareorg / r2retdec

RetDec plugin for Radare2
https://retdec.com/
MIT License
125 stars 24 forks source link

Unable to install with r2pm - Ubuntu 20.04 #45

Open br0kej opened 1 year ago

br0kej commented 1 year ago

I have been trying to install r2retdec using r2pm and it is currently failing with the following error.

> r2pm -i r2retdec
Cloning into 'r2retdec'...
remote: Enumerating objects: 60, done.
remote: Counting objects: 100% (60/60), done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 60 (delta 1), reused 25 (delta 0), pack-reused 0
Unpacking objects: 100% (60/60), 64.43 KiB | 999.00 KiB/s, done.
Install Done For r2retdec
make: *** No rule to make target 'install'.  Stop.

From digging into ~/.local/share/radare2/r2pm/git/r2retdec and executing make - I get the following error:

> make
mkdir -p p && cd p && cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Found PkgConfig: /bin/pkg-config (found version "0.29.1") 
-- Checking for one of the modules 'r_core'
-- Found Radare2: Radare2::libr  
make[1]: Entering directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
make[2]: Entering directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
make[3]: Entering directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
Scanning dependencies of target retdec-populate
make[3]: Leaving directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
make[3]: Entering directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
[ 11%] Creating directories for 'retdec-populate'
[ 22%] Performing download step (git clone) for 'retdec-populate'
Cloning into 'retdec-src'...
fatal: reference is not a tree: 73184b0c17b8790ab691217d2ab4cb6d569495fb
CMake Error at retdec-subbuild/retdec-populate-prefix/tmp/retdec-populate-gitclone.cmake:40 (message):
  Failed to checkout tag: '73184b0c17b8790ab691217d2ab4cb6d569495fb'

make[3]: *** [CMakeFiles/retdec-populate.dir/build.make:92: retdec-populate-prefix/src/retdec-populate-stamp/retdec-populate-download] Error 1
make[3]: Leaving directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
make[2]: *** [CMakeFiles/Makefile2:76: CMakeFiles/retdec-populate.dir/all] Error 2
make[2]: Leaving directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'
make[1]: *** [Makefile:84: all] Error 2
make[1]: Leaving directory '/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/_deps/retdec-subbuild'

CMake Error at /usr/share/cmake-3.16/Modules/FetchContent.cmake:915 (message):
  Build step for retdec failed: 2
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FetchContent.cmake:1006 (__FetchContent_directPopulate)
  deps/retdec/CMakeLists.txt:12 (FetchContent_Populate)

-- Configuring incomplete, errors occurred!
See also "/home/br0kej/.local/share/radare2/r2pm/git/r2retdec/p/CMakeFiles/CMakeOutput.log".
make: *** [Makefile:20: p] Error 1

My google foo suggests its something to do with git references/submodules but am unsure.

trufae commented 1 year ago

r2retdec is not really working on linux nowadays, it somehoe works on mac just because how the runtime linker works. but retdec needs to update their capstone and fix their linkage. but still your error seems unrelated to this and yes the packet seems to pick an unexistent commit hash. you can try building it from git by hand instead of r2pm.

The r2retdec is referencing this commit which seems to be removed from the (thirdparty) retdec repository

deps/retdec/CMakeLists.txt: GIT_TAG 73184b0c17b8790ab691217d2ab4cb6d569495fb

Can you try updating it and make a PR with a working one?

br0kej commented 1 year ago

I've just got round to investigating this further and seems to have run into a road block. I haven't been able to get the it to work having played around with several different git commits on Ubuntu 20.04.

I have managed to kinda' get it to work on Mac OS but am running into an odd issue when the CMake build just randomly bugs out with an error 2 - Problem for another day I think.

Want me to close this issue or leave open in case someone else is able to fix?

trufae commented 1 year ago

Uh? After the last release of retdec that should work. Is the problem you are having in retdec or in r2retdec?

I only tested it on macos and it works as expected

trufae commented 1 year ago

Keep the issue open. I will try to find some time in a week or so to check this out