r2retdec
r2retdec copied to clipboard
Support For Termux
Getting same issue as https://github.com/android/ndk/issues/609 when following build instructions as per as readme
Linux and MacOS:
cd retdec-r2plugin
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=
and below error occur on make -jN step . i am using make -j9
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: CMakeFiles/ar-extractortool.dir/ar_extractor.cpp.o: in function std::__ndk1::__fs::filesystem::is_regular_file(std::__ndk1::__fs::filesystem::path const&)': /data/data/com.termux/files/usr/include/c++/v1/filesystem:1721: undefined reference to
std::__ndk1::__fs::filesystem::__status(std::__ndk1::__fs::filesystem::path const&, std::__ndk1::error_code*)'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ../ar-extractor/libretdec-ar-extractor.a(archive_wrapper.cpp.o): in function std::__ndk1::__fs::filesystem::is_directory(std::__ndk1::__fs::filesystem::path const&)': /data/data/com.termux/files/usr/include/c++/v1/filesystem:1686: undefined reference to
std::__ndk1::__fs::filesystem::__status(std::__ndk1::__fs::filesystem::path const&, std::__ndk1::error_code*)'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [_deps/retdec-build/src/ar-extractortool/CMakeFiles/ar-extractortool.dir/build.make:142: _deps/retdec-build/src/ar-extractortool/retdec-ar-extractor] Error 1
make[1]: *** [CMakeFiles/Makefile2:1312: _deps/retdec-build/src/ar-extractortool/CMakeFiles/ar-extractortool.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Hi, I do not know much about developing with android/ndk
but the error might be solved by linking stc++fs manually. Do you see following message at the top of the cmake output?
-- Library stdc++fs NOT found -> linking utils without stdc++fs library
We tried to solve this in RetDec by linking stdc++fs
to the library on any UNIX machine that is not APPLE (clang does not have such a library). Can you check if you can compile RetDec
separately (https://github.com/avast/retdec)? If yes, we can easily reflect this to the plugin.
Do you see following message at the top of the cmake output?
-- Library stdc++fs NOT found -> linking utils without stdc++fs library
yeah exactly i see this . how can i fix it
The easiest solution, for now, would be for you to locate stdc++fs
on your system. When you locate this library, invoke cmake
command again with the parameter -DCMAKE_LIBRARY_PATH=${PATH_TO_FILESTSTEM_DIR}
.
For example on ubuntu with GCC 7 the filesystem is located in /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++fs.a
, so the parameter for cmake would look like:
cmake -DCMAKE_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/
.
If the problem is caused by not linking stdc++fs
this should probably solve the problem.
on termux gcc support is dropped . may you provide prebuilt core_retdec.so for arm64 android
I think libstdc++fs is experimental for the ndk, so probably the best way to go would be to make retdec not depend on this, but i dont know how hard would be to remove this dependency.