Android Cmake Build command failed - android

I'm new with Cmake and ndk , when i build project i got this
Build command failed.
Error while executing process E:\AndroidSdkWindows\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer -BC:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-21 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Fehoo\sdk\ndk-bundle -DCMAKE_TOOLCHAIN_FILE=C:\Users\Fehoo\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:\AndroidSdkWindows\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DANDROID_STL=c++_static}
(include) CMakeLists.txt
-- Check for working C compiler: C:/Users/Fehoo/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
note*
I instale Cmake and ndk with location on C drive
my os is Windows 10 x64

I found the problem it was with the directory of c++ files in CMakeLists file

Related

how do i get more information from a cmake failure in android studio?

android studio 2021.2.1 on win10pro
i just moved to a new machine, and just did a "git clone" to pull my project. when i try to build it i get the error message below.
it appears cmake is failing, but there is no indication of WHY it is failing. i looked at all the various files and paths handed to cmake, and they all appear to exist.
how do i get cmake to give me more information about what has gone wrong?
[CXX1405] error when building with cmake using C:\Users\Gorilla\github\sunclock\sunclock1\app\src\main\cpp\CMakeLists.txt: Build command failed.
Error while executing process C:\Users\Gorilla\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe with arguments {-HC:\Users\Gorilla\github\sunclock\sunclock1\app\src\main\cpp -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=26 -DANDROID_PLATFORM=android-26 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=C:\Users\Gorilla\AppData\Local\Android\Sdk\ndk\21.4.7075529 -DCMAKE_ANDROID_NDK=C:\Users\Gorilla\AppData\Local\Android\Sdk\ndk\21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=C:\Users\Gorilla\AppData\Local\Android\Sdk\ndk\21.4.7075529\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Gorilla\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Gorilla\github\sunclock\sunclock1\app\build\intermediates\cxx\Debug\14685u17\obj\arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:\Users\Gorilla\github\sunclock\sunclock1\app\build\intermediates\cxx\Debug\14685u17\obj\arm64-v8a -DCMAKE_BUILD_TYPE=Debug -BC:\Users\Gorilla\github\sunclock\sunclock1\app.cxx\Debug\14685u17\arm64-v8a -GNinja}

CMake/Android error: "not able to compile a simple test program"

I am trying to compile a CMake project for android.
I use QtCreator to create and compile the project. Using QMake works fine, but CMake projects don't work.
CMake Project parsing failed.
Running "C:\Android\android-sdk\cmake\3.10.2.4988404\bin\cmake.exe -E server "--pipe=\\.\pipe\{78eb9a25-fbdf-4ac7-b840-8cfe89cbd883}" --experimental" in C:\Users\Thorsten\AppData\Local\Temp\QtCreator-Zmienl\qtc-cmake-KUabkXqG.
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=C:/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe", "-DCMAKE_C_COMPILER:STRING=C:/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe", "-DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.0/android_x86_64", "-DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.0/android_x86_64/bin/qmake.exe".
The CXX compiler identification is Clang 8.0.2
Check for working CXX compiler: C:/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
Check for working CXX compiler: C:/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- broken
CMake Error at C:/Android/android-sdk/cmake/3.10.2.4988404/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"C:/Android/android-sdk/ndk-bundle/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: C:/Users/Thorsten/AppData/Local/Temp/QtCreator-Zmienl/qtc-cmake-KUabkXqG/CMakeFiles/CMakeTmp
Run Build Command:"C:/Android/android-sdk/cmake/3.10.2.4988404/bin/ninja.exe" "cmTC_622f7"
[1/2] Building CXX object CMakeFiles/cmTC_622f7.dir/testCXXCompiler.cxx.obj
[2/2] Linking CXX executable cmTC_622f7.exe
FAILED: cmTC_622f7.exe
cmd.exe /C "cd . && C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe CMakeFiles/cmTC_622f7.dir/testCXXCompiler.cxx.obj -o cmTC_622f7.exe -Wl,--out-implib,libcmTC_622f7.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
clang++.exe: error: unable to execute command: program not executable
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/Thorsten/AppData/Local/Temp/QtCreator-Zmienl/qtc-cmake-KUabkXqG/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Thorsten/AppData/Local/Temp/QtCreator-Zmienl/qtc-cmake-KUabkXqG/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
I found several posts about this, but most of them were not answered or simply not useful. I found this helpful, so I added
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
before project(). But now I get
CMake Error in CMakeLists.txt:
No known features for CXX compiler
"Clang"
version 8.0.2.
CMake Project parsing failed.
So far I haven't found something useful for that.
I hope I can get some more help this way.
ps: I recently reinstalled my os (Windows 10), so if I forgot to update something it's not older than two month. I let QtCreator, Visual Studio and Android Studio do the installation of the toolchains.
pps: The project is a new project created by QtCreator

Docker. Build NDK project. The detected version of Ninja () is less than the version of Ninja required by CMake (1.3)

I have project that recently start using ndk. I have CI worked with Docker. After adding ndk to my project I added ndk to docker file, however for now I see problem with Ninja version.
Here's log output
-- Check for working C compiler: /android-ndk-linux/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
CMake Error:
The detected version of Ninja () is less than the version of Ninja required
by CMake (1.3).
CMake Error: Internal CMake error, TryCompile generation of cmake failed
-- Check for working C compiler: /android-ndk-linux/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- broken
CMake Error at /sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"/android-ndk-linux/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" is not
able to compile a simple test program.
Did anyone faced with the same problem? Here's link for my docker file on docker hub https://cloud.docker.com/repository/docker/relgang/ndkfastlane

Android studio error while creating project with NDK support

I tried to create simple android application with NDK support. I followed https://developer.android.com/studio/projects/add-native-code.html#new-project while creating project. After creating project it gives me following error:
External Native Build Issues
Build command failed.
Error while executing 'C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\AndroidNDKExample\app -BD:\AndroidNDKExample\app\.externalNativeBuild\cmake\release\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\AndroidNDKExample\app\build\intermediates\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=19 -DCMAKE_CXX_FLAGS=-frtti -fexceptions}
-- Configuring incomplete, errors occurred!
CMake Error at C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake:351 (message):
Failed to parse Android NDK revision:
C:/Users/Nilesh.Kashid/AppData/Local/Android/Sdk/ndk-bundle/source.properties.
Call Stack (most recent call first):
C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Error:executing external native build for cmake D:\AndroidNDKExample\app\CMakeLists.txt
Build command failed.
Error while executing 'C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\AndroidNDKExample\app -BD:\AndroidNDKExample\app\.externalNativeBuild\cmake\debug\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\AndroidNDKExample\app\build\intermediates\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=19 -DCMAKE_CXX_FLAGS=-frtti -fexceptions}
-- Configuring incomplete, errors occurred!
CMake Error at C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake:351 (message):
Failed to parse Android NDK revision:
C:/Users/Nilesh.Kashid/AppData/Local/Android/Sdk/ndk-bundle/source.properties.
Call Stack (most recent call first):
C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Error:executing external native build for cmake D:\AndroidNDKExample\app\CMakeLists.txt
I have downloaded CMake and LLDB android I am using Android Studio 2.2.3 version.
I had the same problem. This problem occurs in older versions of ndk.
Failed to parse Android NDK revision:
The problem was resolved after updating ndk.
The current ndk version is 13.1.3345770.
Reference :
https://developer.android.com/ndk/guides/index.html

Android Studio Gradle Fail

I tried to build my android project, I got this error message.
Error while executing 'C:\Users\Chen\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HC:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app -BC:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app.externalNativeBuild\cmake\release\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Chen\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app\build\intermediates\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:\Users\Chen\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Chen\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=15 -DCMAKE_CXX_FLAGS=}
-- Check for working C compiler: C:/Users/Chen/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/Chen/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken
-- Configuring incomplete, errors occurred!
CMake Error: Could not open file for write in copy operation C:/Users/Chen/Desktop/Project/IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160/IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160/IPS_Android/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/3.6.0-rc2/CMakeCCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
I've installed CMAKE, LLDB, NDK. Can I get some help?
Thanks.
I think you need to install compiler driver of c++.

Categories

Resources