CppAndroidIosExample icon indicating copy to clipboard operation
CppAndroidIosExample copied to clipboard

Android ndk build failed " is not able to compile a simple test" while executing this Android code in Android studio, Windows

Open aneesu401 opened this issue 5 years ago • 1 comments

Build command failed. Error while executing process E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HE:\Android\ndk\CppAndroidIosExample-master\Android\app -BE:\Android\ndk\CppAndroidIosExample-master\Android\app.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-16 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\Android\ndk\CppAndroidIosExample-master\Android\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\ndk\21.3.6528147 -DCMAKE_CXX_FLAGS=-std=c++14 -DCMAKE_TOOLCHAIN_FILE=E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\ndk\21.3.6528147\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} -- Check for working C compiler: E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- Check for working C compiler: E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken CMake Error at E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: E:/Android/ndk/CppAndroidIosExample-master/Android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp

Run Build Command:"E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\cmake\3.6.4111459\bin\ninja.exe" "cmTC_51346"

[1/2] Building C object CMakeFiles/cmTC_51346.dir/testCCompiler.c.o

FAILED: E:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\ndk\21.3.6528147\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=armv7-none-linux-androideabi16 --gcc-toolchain=E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=E:/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -fPIE -o CMakeFiles/cmTC_51346.dir/testCCompiler.c.o -c E:\Android\ndk\CppAndroidIosExample-master\Android\app.externalNativeBuild\cmake\debug\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c

ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt

-- Configuring incomplete, errors occurred! See also "E:/Android/ndk/CppAndroidIosExample-master/Android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log". See also "E:/Android/ndk/CppAndroidIosExample-master/Android/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".

aneesu401 avatar Oct 31 '20 11:10 aneesu401

Unfortunately I don't have a Windows machine to test it, anyone able to replicate the problem and make a PR with a fix is welcome.

ademar111190 avatar Mar 14 '21 13:03 ademar111190