-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Hi @PatriceBlin I've been having some issues trying to build the plugin locally. I've been following your guide on how to do this with the android NDK.
I'm trying to do this for NDK r25 revision r450784d.
Environment is macOS 13.6 with an Apple Silicon chip.
LLVM_HOME is set to: ~/tmp/llvm-toolchain/out/stage2-install/
LLVM_DIR is set to: $LLVM_HOME/lib64/cmake
TOOLCHAIN is ~/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64
CXX_HEADERS is set to: $LLVM_HOME/include/c++/v1
but I've tried these as well:
android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++
android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/include/c++
When I try to build the plugin I get the following:
$cmake -S ~/obfuscator-llvm -B ~/tmp/llvm-obfuscation-ndk -D LLVM_DIR="$LLVM_DIR" -D CMAKE_CXX_COMPILER=$CXX -D CMAKE_CXX_FLAGS="$CXXFLAGS"
-- The C compiler identification is Clang 14.0.6
-- The CXX compiler identification is Clang 14.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
-- Check for working C compiler: /Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.27.6/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/Users/andre.bedran/tmp/llvm-obfuscation-ndk/CMakeFiles/CMakeScratch/TryCompile-wSc4q3'
Run Build Command(s): /opt/homebrew/Cellar/cmake/3.27.6/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_da402/fast
/Applications/Xcode.14.3.1.14E300b.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_da402.dir/build.make CMakeFiles/cmTC_da402.dir/build
Building C object CMakeFiles/cmTC_da402.dir/testCCompiler.c.o
/Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -isystem /Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/ -I/Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1 -arch arm64 -isysroot /Applications/Xcode.14.3.1.14E300b.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -MD -MT CMakeFiles/cmTC_da402.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_da402.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_da402.dir/testCCompiler.c.o -c /Users/andre.bedran/tmp/llvm-obfuscation-ndk/CMakeFiles/CMakeScratch/TryCompile-wSc4q3/testCCompiler.c
Linking C executable cmTC_da402
/opt/homebrew/Cellar/cmake/3.27.6/bin/cmake -E cmake_link_script CMakeFiles/cmTC_da402.dir/link.txt --verbose=1
/Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -isystem /Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/ -I/Users/andre.bedran/tmp/android-ndk-r25/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1 -arch arm64 -isysroot /Applications/Xcode.14.3.1.14E300b.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L CMakeFiles/cmTC_da402.dir/testCCompiler.c.o -o cmTC_da402
ld: error: unknown argument '-dynamic', did you mean '-Bdynamic'
ld: error: unknown argument '-arch'
ld: error: unknown argument '-syslibroot'
ld: error: unknown argument '-search_paths_first'
ld: error: unknown emulation: acosx_version_min
ld: error: cannot open arm64: No such file or directory
ld: error: cannot open 13.0.0: No such file or directory
ld: error: cannot open /Applications/Xcode.14.3.1.14E300b.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk: Is a directory
ld: error: unable to find library -lSystem
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_da402] Error 1
make: *** [cmTC_da402/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!```
Looks like either I have a completely broken clang in my NDK installation, or I'm missing something crucial for it to work.
I have applied the fixes to `CryptoUtils.h` and `CMakeLists.txt` from the macOS build fix branch already, and I've tried some things you mentioned in #6 without success.
Do you have any thoughts? Thanks in advance.
P.S.: If you have any guidance on how to use the plugin through gradle afterwards, that would be great too.
Metadata
Metadata
Assignees
Labels
No labels