0

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:\Users\Mouad AITALI\AndroidStudioProjects\MUSIC_MAKER\soxcommandlibrary\src\main\sox\CMakeLists.txt: Build command failed.
Error while executing process D:\Sdk\cmake\3.18.1\bin\cmake.exe with arguments {-HC:\Users\Mouad AITALI\AndroidStudioProjects\MUSIC_MAKER\soxcommandlibrary\src\main\sox -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:\Sdk\ndk-bundle -DCMAKE_ANDROID_NDK=D:\Sdk\ndk-bundle -DCMAKE_TOOLCHAIN_FILE=D:\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=D:\Sdk\cmake\3.18.1\bin\ninja.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Mouad AITALI\AndroidStudioProjects\MUSIC_MAKER\soxcommandlibrary\build\intermediates\cxx\Debug\4z35f2d3\obj\arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:\Users\Mouad AITALI\AndroidStudioProjects\MUSIC_MAKER\soxcommandlibrary\build\intermediates\cxx\Debug\4z35f2d3\obj\arm64-v8a -DCMAKE_BUILD_TYPE=Debug -BC:\Users\Mouad AITALI\AndroidStudioProjects\MUSIC_MAKER\soxcommandlibrary\.cxx\Debug\4z35f2d3\arm64-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:\Sdk\cmake\3.18.1\bin\ninja.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:\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.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 Answers2

0

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:

implementation(files("./libs/soxcommandlibrary-release.aar"))
0

Downgrade to earlier version of ndk

Downgrading ndk is improving the build in a native c++ project so far.

Downgrading to:

  • ndk 21.4.7075529
  • cmake 3.10.2
  • maintain Android 12 as build target (requirements of the new appcompat library)
  • minsdk can go below 32

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.