2

I'm currently testing the Visual Studio 2017 RC CMake support for Android NDK C++ projects on Windows and encountered an issue.

When I try to generate the CMake cache with:

<cmake.exe> -G "Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX:PATH=<install_path> -DCMAKE_TOOLCHAIN_FILE="<androidNDK_path>\build\cmake\android.toolchain.cmake" -DANDROID_TOOLCHAIN=gcc -DANDROID_ABI="armeabi-v7a with NEON" --DCMAKE_BUILD_TYPE="Debug" <source>

I get the following error (The same happens with clang if I don't force gcc):

The C compiler "<androidNDK_path>/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc.exe" is not able to compile a simple test program.

Before that I get the warnings that the identification of the C and CXX compilers are unknown but I'm not sure that's relevant.

I get more errors for the temporary test project but they don't seem to give a lot of information like

C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(57,5):
error MSB4018: The "VCMessage" task failed unexpectedly.

and

C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(57,5):
error MSB4018: System.FormatException: Index (zero based) must be greater
than or equal to zero and less than the size of the argument list.

How could I troubleshoot this?

1 Answer 1

2

For everybody who finds this post and has the same issue: the problem seems to be the Visual Studio generator. Also it seems like the Android toolchains requires an argument with the path to "make". So to solve both I installed MSYS (http://www.mingw.org/wiki/MSYS) and changed the CMake command to:

<cmake.exe>  -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=<install_path> -DCMAKE_TOOLCHAIN_FILE="<androidNDK_path>\build\cmake\android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="<MinGW_path>\msys\1.0\bin\make.exe" -DANDROID_TOOLCHAIN=gcc -DANDROID_ABI="armeabi-v7a with NEON" --DCMAKE_BUILD_TYPE="Debug" <source>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.