Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support For Termux #25

Open
apkunpacker opened this issue Nov 8, 2020 · 5 comments
Open

Support For Termux #25

apkunpacker opened this issue Nov 8, 2020 · 5 comments
Labels

Comments

@apkunpacker
Copy link

Getting same issue as
android/ndk#609
when following build instructions as per as readme

Linux and MacOS:
cd retdec-r2plugin
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=
make -jN (N is the number of processes to use for parallel build, typically number of cores + 1 gives fastest compilation time)
make install

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....

Screenshot_2020-11-08-08-19-59-03

@xkubov
Copy link
Contributor

xkubov commented Dec 1, 2020

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.

@xkubov xkubov added the P-build label Dec 1, 2020
@apkunpacker
Copy link
Author

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

@xkubov
Copy link
Contributor

xkubov commented Dec 1, 2020

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.

@apkunpacker
Copy link
Author

apkunpacker commented Dec 4, 2020

on termux gcc support is dropped . may you provide prebuilt core_retdec.so for arm64 android

@radare
Copy link
Contributor

radare commented Dec 20, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants