-
Notifications
You must be signed in to change notification settings - Fork 42
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
Trouble building/using Android toolchain #6
Comments
Hi, I will try to rebuild with r26b NDK check if I see the same thing. |
Yes, LLVM was built with |
Hi, Sorry for the delay. I checked with r23c and I also had some undefined symbols. I wasn't able to find my old setup for differences with the doc. If it helps, back then I found this article (in Chinese) very useful to rebuild with the NDK. For posterity I tested Rebuild llvm-toolchain
To recompile the plugin (on host) VERSION="r23c"
REVISION="r416183c"
# Extracted NDK from zip
NDK=${HOME}/tmp/ndk/android-ndk-$VERSION
# Cloned llvm-toolchain
LLVM_NDK=${HOME}/tmp/llvm-toolchain
# Rebuild "stage2" llvm-toolchain
LLVM_HOME=${LLVM_NDK}/out/stage2-install/
HOST_CLANG="$LLVM_NDK/prebuilts/clang/host/linux-x86/clang-$REVISION"
HOST_SYSROOT_NDK="$NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
HOST_INCLUDES="$HOST_SYSROOT_NDK/usr/include"
CXX_HEADERS="${LLVM_NDK}/out/stage2-install/include/c++/v1"
CFLAGS="-isystem $HOST_INCLUDES"
CXXFLAGS="-isystem $HOST_INCLUDES -I$CXX_HEADERS" The issues is related to mix-up with C++ headers so either using CXX headers from NDK or the rebuild "stage2" should fix it. For exemple for NDK r23c there is:
I forgot which one is correct and didn't had time to test them out. |
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 !
The text was updated successfully, but these errors were encountered: