Nice and great work, especially for providing the ndk with Ollvm support.
The current NDK setup poses a challenge [initially reported by
@rudrakshik]: the 4GB one (with OLLVM support) is required for this project but isn't compatible with other projects like dex2c/d2c, which then will need a seperate NDK (2GB). Maintaining both versions will consume a hefty storage(6GB), which is far from ideal.
So, here's how you can fix the errors with the recommended Ollvm NDK to work with other projects like dex2c/d2c, so you'll only need to maintain one NDK version.
1.
Error: Unknown Host CPU Architecture (aarch64)
: Navigate to the extracted NDK directory (e.g., $HOME/android-sdk/ndk/25.2.9519653) and run:
sed -i '/case \$HOST_ARCH in/a\\ aarch64) HOST_ARCH=aarch64;;' build/tools/ndk_bin_common.sh
cd prebuilt && ln -s linux-x86_64/ linux-aarch64 && cd ..
cd toolchains/llvm/prebuilt/ && ln -s linux-x86_64/ linux-aarch64 && cd ../../..
2.
Error: `Cannot find 'make' program. Please install Cygwin make package...
`: This happens because the make binary of this ndk is not compatible with aarch64 architecture.
Use one of these methods:
-
A:cd prebuilt/linux-x86_64/bin/ && rm make && ln -s $(which make) make
-
B:export GNUMAKE=$(which make)
Enjoy!
Also, if you don't want to do these yourself, you can grab the fixed ndk archive from here:
https://github.com/codehasan/dex2c/releases/tag/ollvm-termuxJust extract it and use it as your NDK for Dex2c or DexVMP.
BTW, with OLLVM NDK available to ourselves, why not compile Dex2c with OLLVM support?
Who said we can't? Let's do it!
For those looking to use this same Ollvm NDK with Dex2c, here's how:
1. Switch to the Ollvm branch in the Dex2c repository:
git pull
git fetch
git switch ollvm
2. Use the --ollvm flag when compiling. Example:
python3 dcc.py -a input.apk -o output.apk --ollvm
That’s it! All Done, Enjoy :)
#dex2c
~ @AbhiTheM0dder