KhronosGroup / Vulkan-Tools

Vulkan Development Tools
Apache License 2.0
363 stars 155 forks source link

Android build failure #980

Closed yaman-lunarg closed 2 months ago

yaman-lunarg commented 6 months ago

$ cmake -S . -B build \

-D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ -D ANDROID_PLATFORM=26 \ -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a \ -D CMAKE_ANDROID_STL_TYPE=c++_static \ -D ANDROID_USE_LEGACY_TOOLCHAIN_FILE=NO \ -D CMAKE_BUILD_TYPE=Release \ -D UPDATE_DEPS=ON \ -G Ninja -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Users/Vector/AppData/Local/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Users/Vector/AppData/Local/ndk/21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done Starting builds in D:\Personal\Projects\LunarG_repo\vulkanTools\external\Android\Release\armv7-a Installed Vulkan-Headers (v1.3.280) in 0.6241400241851807 seconds Installed volk (vulkan-sdk-1.3.280) in 1.1439473628997803 seconds -- Found Git: D:/Program Files/Git/mingw64/bin/git.exe (found version "2.32.0.windows.2") -- Configuring done (13.6s) CMake Error at cube/CMakeLists.txt:229 (target_link_libraries): Target "vkcube" links to:

Vulkan::Headers

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

CMake Error at vulkaninfo/CMakeLists.txt:109 (target_link_libraries): Target "vulkaninfo" links to:

Vulkan::Headers

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

-- Generating done (0.0s) CMake Generate step failed. Build files cannot be regenerated correctly.

charles-lunarg commented 6 months ago

Can you post the CMakeCache.txt, and any relevant CMake logs?

I can see that Vulkan-Headers was installed locally, but it seems that Vulkan-Tools was not made aware of it.

I assume the build is trying to use the clang compiler but I just want to confirm that.

yaman-lunarg commented 6 months ago

Found 3 cmake cache files: CMakeCache.txt CMakeCache (1).txt CMakeCache (2).txt

charles-lunarg commented 6 months ago

Could you also include the D:/Users/Vector/AppData/Local/ndk/21.3.6528147/build/cmake/android.toolchain.cmake file?

Wait, this looks like an issue: -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a Then later on, it appears `armv7-a' is where the Vulkan-Headers are being installed.

Starting builds in D:\Personal\Projects\LunarG_repo\vulkanTools\external\Android\Release\armv7-a

yaman-lunarg commented 6 months ago

Arm 7 vs 8 also caught my attention. .txt to make github happy. I have 3 different NDKs: 21.3.6528147 25.2.9519653 26.2.11394342 android.toolchain.cmake.txt

charles-lunarg commented 6 months ago

So excuse my ignorance, but do you need to use a specific ndk with each android platform? I see that its using the 21.3.xxx ndk while the ANDROID_PLATFORM is 26.

yaman-lunarg commented 6 months ago

I am very new to this android environment. Not sure how I ended up with three.

charles-lunarg commented 6 months ago

I'm not much better, and all of my android experience is on linux so I cannot rule out weirdness due to Windows.

yaman-lunarg commented 6 months ago

25.2.9519653 is probably related to Khronos Samples.

yaman-lunarg commented 6 months ago

Re-run the build using $ANDROID_NDK_HOME set to D:\Users\Vector\AppData\Local\ndk\26.2.11394342. Same error.

mikes-lunarg commented 2 months ago

Closing this issue as I cannot reproduce the build error reported here. I've tested the Android build instructions on both Windows and Linux, using both the listed CMake command as well as the android.py helper script and everything worked as expected.