I’m trying to run my app as I always do, but after updating the Android Studio to the latest version : 2021.1.1 Patch 3, I get the following error :
[CXX1405] error when building with cmake using C:UsersMouad AITALIAndroidStudioProjectsMUSIC_MAKERsoxcommandlibrarysrcmainsoxCMakeLists.txt: Build command failed.
Error while executing process D:Sdkcmake3.18.1bincmake.exe with arguments {-HC:UsersMouad AITALIAndroidStudioProjectsMUSIC_MAKERsoxcommandlibrarysrcmainsox -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=19 -DANDROID_PLATFORM=android-19 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=D:Sdkndk-bundle -DCMAKE_ANDROID_NDK=D:Sdkndk-bundle -DCMAKE_TOOLCHAIN_FILE=D:Sdkndk-bundlebuildcmakeandroid.toolchain.cmake -DCMAKE_MAKE_PROGRAM=D:Sdkcmake3.18.1binninja.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersMouad AITALIAndroidStudioProjectsMUSIC_MAKERsoxcommandlibrarybuildintermediatescxxDebug4z35f2d3objarm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:UsersMouad AITALIAndroidStudioProjectsMUSIC_MAKERsoxcommandlibrarybuildintermediatescxxDebug4z35f2d3objarm64-v8a -DCMAKE_BUILD_TYPE=Debug -BC:UsersMouad AITALIAndroidStudioProjectsMUSIC_MAKERsoxcommandlibrary.cxxDebug4z35f2d3arm64-v8a -GNinja}
-- The C compiler identification is Clang 11.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: D:/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
-- Configuring incomplete, errors occurred!
See also "C:/Users/Mouad AITALI/AndroidStudioProjects/MUSIC_MAKER/soxcommandlibrary/.cxx/Debug/4z35f2d3/arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Mouad AITALI/AndroidStudioProjects/MUSIC_MAKER/soxcommandlibrary/.cxx/Debug/4z35f2d3/arm64-v8a/CMakeFiles/CMakeError.log".
CMake Error at D:/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"D:/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/Mouad AITALI/AndroidStudioProjects/MUSIC_MAKER/soxcommandlibrary/.cxx/Debug/4z35f2d3/arm64-v8a/CMakeFiles/CMakeTmp
Run Build Command(s):D:Sdkcmake3.18.1binninja.exe cmTC_b4ad3 && [1/2] Building C object CMakeFiles/cmTC_b4ad3.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_b4ad3
FAILED: cmTC_b4ad3
cmd.exe /C "cd . && D:Sdkndk-bundletoolchainsllvmprebuiltwindows-x86_64binclang.exe --target=aarch64-none-linux-android21 --gcc-toolchain=D:/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Sdk/ndk-bundle/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 -Wformat -Werror=format-security -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -Wl,--gc-sections CMakeFiles/cmTC_b4ad3.dir/testCCompiler.c.o -o cmTC_b4ad3 -latomic -lm && cd ."
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:68 (project)
2
Answers
Unfortunately, it's not an optimal solution, but I ended up generating an AAR file, and removing the whole folder (which contains CMakeList.txt file) then I use the following:
Downgrade to earlier version of ndk
Downgrading ndk is improving the build in a native c++ project so far.
Downgrading to:
Downgrading to earlier versions of ndk and cmake that are specifically listed on Android developer website in a table of tested previous ndk release points.
Android Developer is working well to stay up to date with cmake. Android developers will likely have this issue fixed in the not to distant future.