klaxit/hidden-secrets-gradle-plugin

CMake failed testCCompiler.c missing?

sreeh1986 opened this issue · 10 comments

Hi,
after adding the cmake path to my build.gradle and syncing, I received the following error messages:

C/C++ debug|armeabi-v7a : CMake Error at C:/Users/.../AppData/Local/Android/sdk/cmake/3.10.2.4988404/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "C:/Users/.../AppData/Local/Android/sdk/ndk/21.1.6352462/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: P:/.../app/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp
    
    Run Build Command:"C:\Users\...\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe" "cmTC_f0e2c"
    [1/2] Building C object CMakeFiles/cmTC_f0e2c.dir/testCCompiler.c.o
    FAILED: CMakeFiles/cmTC_f0e2c.dir/testCCompiler.c.o 
    C:\Users\...\AppData\Local\Android\sdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=armv7-none-linux-androideabi24 --gcc-toolchain=C:/Users/.../AppData/Local/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/.../AppData/Local/Android/sdk/ndk/21.1.6352462/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_f0e2c.dir/testCCompiler.c.o   -c testCCompiler.c
    clang: error: no such file or directory: 'testCCompiler.c'
    clang: error: no input files
    ninja: build stopped: subcommand failed.
    

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

Any idea whats going wrong? Is the file testCCompiler.c missing? What is this?

Thank you.

Hello @sreeh1986 ,

I have never see this error before. Did you follow the readme and add the key with the hideSecret command before to run the project ?

What is your AndroidStudio version ?

Hi Benjamin,
yes, all steps before were successful and I generated the secret. AndroidStudio is version 4.1.1 with newest gradle. OS is Windows 10 1909 64 bit.

Thank you.

@sreeh1986 thanks for the details, can you check your cmake settings with this link ? https://developer.android.com/studio/projects/install-ndk

In the same time I will try the plugin on a new app using Windows 10.

Hi @ben-j69
I checked the link. I have installed cmake in version 3.10.2 and NDK in version 21.1.6352462, which is prefered for Android Studio 4.1.

Hello @sreeh1986 , after your cmake update, does it work now ?

Hi @ben-j69 Sorry I forgot to say, this were already the versions I have installed. I didn´t have to update cmake and ndk.

@sreeh1986 I don't think this error is directly related with the plugin.

Did you already succeed to build Android app running ndk on your computer ?

What is the exact path to C:/Users/.../AppData/Local/Android/sdk/cmake/ ? Some people have issues when there is a space in the path, that could explain why the file is not found : https://stackoverflow.com/questions/53978982/android-studio-3-2-initial-build-error-testccompiler-c-file-not-found-windows

This is the first project that uses NDK. No space in path.
But I think it works now. I have downloaded NDK in the newest version 22.0.7026061 and set the android.ndkVersion property manually to 22.0.7026061 in the build.gradle. Now the build is sucessful. So far, so good, but I don´t understand, why it don´t work with standard version 21.1.6352462.
Do you have an idea? Anyway thank you very much!

@sreeh1986 I don't know why you need a specific version of the ndk. I did not have this issue.
If this issue is fixed can I close it ?
Thanks

Yes, thank you!