You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed Visual Studio 2022 (17), Android Studio, separate cmake (not from VS), NDK, and I am trying to compile a simple project as well as some of my code. When I run cmake in cmd with -DCMAKE_ANDROID_NDK=C:/programs/Android/sdk/ndk/28.0.12674087, it runs fine, albeit showing a warning from cmake that it can only make libraries using VisualStudio's Android:
cmake ^
-A ARM ^
-DCMAKE_SYSTEM_NAME=Android ^
-DCMAKE_SYSTEM_VERSION=31 ^
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a ^
-DCMAKE_ANDROID_NDK=C:/programs/Android/sdk/ndk/28.0.12674087 ..
-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/programs/Android/sdk/ndk/28.0.12674087/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/programs/Android/sdk/ndk/28.0.12674087/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"C:/programs/Android/sdk/ndk/28.0.12674087/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:/Repositories/Android-CMake-VisualStudio-Sample/bin/CMakeFiles/CMakeScratch/TryCompile-2s3wlz'
Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_a12ff.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
MSBuild version 17.12.12+1cce77968 for .NET Framework
Build started 2024-12-16 17:05:55.
Project "C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\cmTC_a12ff.vcxproj" on node 1 (default targets).
SetBuildDefaultEnvironmentVariables:
ANDROID_HOME=C:\programs\Android\sdk
ANDROID_SDK_ROOT=C:\programs\Android\sdk
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\programs\Android\sdk\ndk\28.0.12674087
PrepareForBuild:
Creating directory "cmTC_a12ff.dir\Debug\".
Creating directory "C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\Debug\".
Creating directory "cmTC_a12ff.dir\Debug\cmTC_a12ff.tlog\".
InitializeBuildStatus:
Creating "cmTC_a12ff.dir\Debug\cmTC_a12ff.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
Touching "cmTC_a12ff.dir\Debug\cmTC_a12ff.tlog\unsuccessfulbuild".
ClCompile:
C:\programs\Android\sdk\ndk\28.0.12674087\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe -c -fdiagnostics-format=msvc --gcc-toolchain="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64" -target "x86_64-none-linux-android1" --sysroot="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot" -isystem "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\x86_64-linux-android" -isystem "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\lib64\\clang\\19.0.0\\include" -isystem C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\sources\\android\\support\\include -isystem "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include" -I "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\sources\\cxx-stl\\llvm-libc++\\include" -I "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\sources\\cxx-stl\\llvm-libc++abi\\include" -I "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include" -I "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\x86_64-linux-android" -I C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\sources\\android\\support\\include -I "C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\lib64\\clang\\19.0.0\\include" -gline-tables-only -o "cmTC_a12ff.dir\\Debug\\testCCompiler.o" -Wall -O3 -fno-strict-aliasing -fomit-frame-pointer -fno-exceptions -ffunction-sections -fdata-sections -fstack-protector -fpic -fno-short-enums -D __ANDROID_MIN_SDK_VERSION__=1 -D NDEBUG -D ANDROID -D _FORTIFY_SOURCE=2 -D "CMAKE_INTDIR=\"Debug\"" -x c -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wformat -Werror=format-security -fno-limit-debug-info "C:\\Repositories\\Android-CMake-VisualStudio-Sample\\bin\\CMakeFiles\\CMakeScratch\\TryCompile-2s3wlz\\testCCompiler.c"
testCCompiler.c
Link:
C:\programs\Android\sdk\ndk\28.0.12674087\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe -fdiagnostics-format=msvc -o"cmTC_a12ff.dir\\Debug\\cmTC_a12ff." -Wl,-soname="cmTC_a12ff." -Wl,-rpath-link="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\x86_64-linux-android" -Wl,-rpath-link="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\x86_64-linux-android\\1" -Wl,-L"C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\x86_64-linux-android" -Wl,-L"C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\x86_64-linux-android\\1" -Wl,-L"C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64\\lib\\gcc\\x86_64-linux-android\\4.9.x" -Wl,-L"C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\sources\\cxx-stl\\llvm-libc++\\libs\\x86_64" -Wl,--no-undefined --gcc-toolchain="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\x86_64-4.9\\prebuilt\\windows-x86_64" -target "x86_64-none-linux-android1" --sysroot="C:\\programs\\Android\\sdk\\ndk\\28.0.12674087\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot" -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -shared -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments cmTC_a12ff.dir\\Debug\\testCCompiler.o "-latomic" "-lm" -lc++_static -lc++abi -llog -landroid
ld.lld: error: cannot open crtbegin_so.o: No such file or directory
ld.lld: error: unable to find library -llog
ld.lld: error: unable to find library -landroid
ld.lld: error: cannot open crtend_so.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Application Type\Android\3.0\Android.Common.targets(125,5): error MSB6006: "clang.exe" exited with code 1. [C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\cmTC_a12ff.vcxproj]
Done Building Project "C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\cmTC_a12ff.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\cmTC_a12ff.vcxproj" (default target) (1) ->
(Link target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Application Type\Android\3.0\Android.Common.targets(125,5): error MSB6006: "clang.exe" exited with code 1. [C:\Repositories\Android-CMake-VisualStudio-Sample\bin\CMakeFiles\CMakeScratch\TryCompile-2s3wlz\cmTC_a12ff.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.30
cl and clang are definitely available, so I am confused as to why it cannot find them. Any suggestions are appreciated.
I am using a supported NDK
I have checked and the NDK I'm using is currently supported
Affected versions
r28
The text was updated successfully, but these errors were encountered:
Description
I have installed Visual Studio 2022 (17), Android Studio, separate cmake (not from VS), NDK, and I am trying to compile a simple project as well as some of my code. When I run cmake in cmd with
-DCMAKE_ANDROID_NDK=C:/programs/Android/sdk/ndk/28.0.12674087
, it runs fine, albeit showing a warning from cmake that it can only make libraries using VisualStudio's Android:When I try to run using toolchain:
It breaks with the following error:
cl and clang are definitely available, so I am confused as to why it cannot find them. Any suggestions are appreciated.
I am using a supported NDK
Affected versions
r28
The text was updated successfully, but these errors were encountered: