<div dir="ltr">Although there didn't seem to be any interest in my thread, I figured I should still update with my partial success. I've managed to get LLVM to build with Android NDK and have put together scripts to encapsulate the necessary commands. See <a href="https://github.com/Jman420/llvm_for_android">https://github.com/Jman420/llvm_for_android</a> for scripts and instructions.<div><br></div><div>For some reason the '*.exports' files do not seem to get generated correctly. They end up with double quoted lines (such as '"LLVM {"') which seem to be invalid format. Unfortunately, I haven't been able to figure out where/what generates those files. They seem to be generated by the actual compiler since those files don't exist until I execute 'cmake --build . --target install'.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 13, 2019 at 5:13 PM Justin Giannone <<a href="mailto:jman.giannone@gmail.com">jman.giannone@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hey Guys,<div><br></div><div>Still struggling with this. Wondering if anyone has any recommendations?</div><div><br></div><div>The command I'm using to generate the Ninja Build Files and execute the build are :</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">AndroidSdkDir="$LOCALAPPDATA/Android/Sdk"<br>AndroidCmakeExe="$AndroidSdkDir/cmake/3.10.2.4988404/bin/cmake.exe"<br>AndroidNinjaExe="$AndroidSdkDir/cmake/3.10.2.4988404/bin/ninja.exe"<br>NdkBundle="$AndroidSdkDir/ndk-bundle/"<br>ToolchainFile="$NdkBundle/build/cmake/android.toolchain.cmake"<br>ArchTargets="armeabi-v7a"<br><br>$AndroidCmakeExe \<br>-DBUILD_SHARED_LIBS=1 \<br>-DLLVM_BUILD_LLVM_DYLIB=1 \<br>-DLLVM_BUILD_TOOLS=0 \<br>-DLLVM_BUILD_UTILS=0 \<br>-DLLVM_INCLUDE_BENCHMARKS=0 \<br>-DLLVM_INCLUDE_DOCS=0 \<br>-DLLVM_INCLUDE_EXAMPLES=0 \<br>-DLLVM_INCLUDE_GO_TESTS=0 \<br>-DLLVM_INCLUDE_RUNTIMES=1 \<br>-DLLVM_INCLUDE_TESTS=0 \<br>-DLLVM_INCLUDE_TOOLS=0 \<br>-DLLVM_INCLUDE_UTILS=0 \<br>\<br>-DLLVM_DEFAULT_TARGET_TRIPLE=armv7a-linux-androideabi \<br>-DLLVM_TARGET_ARCH=ARM \<br>-DLLVM_TARGETS_TO_BUILD=ARM \<br>\<br>-DPYTHON_EXECUTABLE="$NdkBundle/prebuilt/windows-x86_64/bin/python2.7.exe" \<br>-DANDROID_NDK="$NdkBundle" \<br>-DANDROID_ABI="$archTarget" \<br>\<br>-DCMAKE_INSTALL_PREFIX=../../build-android/armeabi-v7a \<br>-DCMAKE_CROSSCOMPILING=True \<br>-DCMAKE_SYSTEM_NAME=Android \<br>-DANDROID_PLATFORM=android-21 \<br>-DCMAKE_SYSTEM_VERSION=21 \<br>-DCMAKE_ANDROID_NDK="$NdkBundle" \<br>-DCMAKE_TOOLCHAIN_FILE="$ToolchainFile" \<br>-DCMAKE_MAKE_PROGRAM="$AndroidNinjaExe" \<br>-G "Ninja" \<br>../../llvm-8.0.0.src<br><br>$AndroidCmakeExe --build .<br></blockquote><div> <br></div><div>And the full error output from the build is :</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[186/1329] Creating export file for LLVMHello<br>FAILED: lib/Transforms/Hello/LLVMHello.exports<br>cmd.exe /C "cd /D C:\JStash\Projects\llvm\llvm_android_project\armeabi-v7a\lib\Transforms\Hello && echo "LLVM_8 {" > LLVMHello.exports && ( grep -q [[:alnum:]] C:/JStash/Projects/llvm/llvm-8.0.0.src/lib/Transforms/Hello/Hello.exports && echo " global:" >> LLVMHello.exports || : ) && sed -e s/$/;/ -e "s/^/ /" < C:/JStash/Projects/llvm/llvm-8.0.0.src/lib/Transforms/Hello/Hello.exports >> LLVMHello.exports && echo " local: *;" >> LLVMHello.exports && echo }; >> LLVMHello.exports"<br>':' is not recognized as an internal or external command,<br>operable program or batch file.<br>[195/1329] Configuring NATIVE LLVM...<br>FAILED: NATIVE/CMakeCache.txt<br>cmd.exe /C "cd /D C:\JStash\Projects\llvm\llvm_android_project\armeabi-v7a\NATIVE && C:\Users\jgiannone\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\cmake.exe -G Ninja -DCMAKE_MAKE_PROGRAM="C:\Users\jgiannone\AppData\Local/Android/Sdk/cmake/3.10.2.4988404/bin/ninja.exe" -DCMAKE_C_COMPILER=C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -DCMAKE_CXX_COMPILER=C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe C:/JStash/Projects/llvm/llvm-8.0.0.src -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE -DLLVM_TARGETS_TO_BUILD="ARM" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="" -DLLVM_DEFAULT_TARGET_TRIPLE="armv7a-linux-androideabi" -DLLVM_TARGET_ARCH="ARM" -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="OFF" -DCMAKE_BUILD_TYPE=Release"<br>-- The C compiler identification is Clang 8.0.7<br>-- The CXX compiler identification is Clang 8.0.7<br>-- The ASM compiler identification is Clang<br>-- Found assembler: C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe<br>-- Check for working C compiler: C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe<br>-- Check for working C compiler: C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken<br>CMake Error at C:/Users/jgiannone/AppData/Local/Android/Sdk/cmake/3.10.2.4988404/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):<br> The C compiler<br><br> "C:/Users/jgiannone/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"<br><br> is not able to compile a simple test program.<br><br> It fails with the following output:<br><br> Change Dir: C:/JStash/Projects/llvm/llvm_android_project/armeabi-v7a/NATIVE/CMakeFiles/CMakeTmp<br><br> Run Build Command:"C:\Users\jgiannone\AppData\Local/Android/Sdk/cmake/3.10.2.4988404/bin/ninja.exe" "cmTC_43bcf"<br> [1/2] Building C object CMakeFiles/cmTC_43bcf.dir/testCCompiler.c.obj<br> [2/2] Linking C executable cmTC_43bcf.exe<br> FAILED: cmTC_43bcf.exe<br> cmd.exe /C "cd . && C:\Users\jgiannone\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe CMakeFiles/cmTC_43bcf.dir/testCCompiler.c.obj -o cmTC_43bcf.exe -Wl,--out-implib,libcmTC_43bcf.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."<br> clang: error: unable to execute command: program not executable<br> clang: error: linker command failed with exit code 1 (use -v to see invocation)<br> ninja: build stopped: subcommand failed.<br><br><br><br><br> CMake will not be able to correctly generate this project.<br>Call Stack (most recent call first):<br> CMakeLists.txt:39 (project)<br><br><br>-- Configuring incomplete, errors occurred!<br>See also "C:/JStash/Projects/llvm/llvm_android_project/armeabi-v7a/NATIVE/CMakeFiles/CMakeOutput.log".<br>See also "C:/JStash/Projects/llvm/llvm_android_project/armeabi-v7a/NATIVE/CMakeFiles/CMakeError.log".<br>ninja: build stopped: subcommand failed.<br></blockquote><div><br></div><div>I'm kinda stumped as to what's going on...</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 8, 2019 at 11:59 AM Justin Giannone <<a href="mailto:jman.giannone@gmail.com" target="_blank">jman.giannone@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hey Guys,<div><br></div><div>I'm working on a project in Android related to System-level Audio DSP Effects for Tuning Android Audio. I want to leverage Faust (<a href="https://faust.grame.fr/" target="_blank">https://faust.grame.fr/</a>) to allow users to program their own filters. Faust provides a libfaust implementation which includes a JIT Compiler which leverages LLVM and seems to be the best path for me to use. Unfortunately I'm having problems cross-compiling LLVM for Android on my Windows Dev machine. Wondering if anyone has any advice for me?</div><div><br></div><div>I've been trying to use the android-ndk cmake & toolchains to build LLVM so that I can cross-compile Faust against the Android LLVM build. I've managed to get Android's cmake to generate an Android Gradle Ninja project, but when I try to build it I get lots of errors that seem to indicate that the Ninja project is invalid, such as the following errors : </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">FAILED: cmTC_4a28c.exe<br><br> cmd.exe /C "cd . &&<br> C:\Users\jgiannone\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe<br> CMakeFiles/cmTC_4a28c.dir/testCCompiler.c.obj -o cmTC_4a28c.exe<br> -Wl,--out-implib,libcmTC_4a28c.dll.a<br> -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32<br> -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32<br> -ladvapi32 && cd ."<br><br> clang: error: unable to execute command: program not executable<br><br> clang: error: linker command failed with exit code 1 (use -v to see<br> invocation)<br><br> ninja: build stopped: subcommand failed.<br></blockquote><div><br></div><div>Thanks!</div><div> </div></div>
</blockquote></div>
</blockquote></div>