Description
Hi,
I'm having difficulties building and using the obfuscator with Android.
I am following the instructions on https://github.com/eshard/obfuscator-llvm/blob/main/docs/ANDROID_NDK.md
I tried using the latest NDK (r25b) as well as the one documented on the page (r23b - but I had to revert the latest changes for llvm 14 in order to make the plugin build)
First of all, I believe --no-build windows --no-build lldb
should be changed into --no-build "windows,lldb"
(with r25b both worked, but with r23b the two-separate option ended up building windows tools anyway)
Then, the instruction says 'Compile the plugin with -D LLVM_DIR=~/tmp/llvm-toolchain/out/stage2-install/lib64/cmake along with a NDK compile environment.' but the code below initializes LLVM_DIR to '${LLVM_HOME}/lib64/cmake'. I believe the first one is correct, please confirm.
With the above changes, I am able to build libLLVMObfuscator.so but using it gives undefined symbols:
/home/spop/obfuscator/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android23-clang++ -I/home/spop/obfuscator/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/home/spop/obfuscator/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android -O1 -fno-legacy-pass-manager -fpass-plugin=out/libLLVMObfuscator.so -c foobar.cpp -o foobar.o error: unable to load plugin 'out/libLLVMObfuscator.so': 'Could not load library 'out/libLLVMObfuscator.so': out/libLLVMObfuscator.so: undefined symbol: _ZNSt6__ndk112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev'
Any idea ? Thanks !