Vulkan-Tools icon indicating copy to clipboard operation
Vulkan-Tools copied to clipboard

Android build failure

Open yaman-lunarg opened this issue 1 year ago • 9 comments

$ 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.

yaman-lunarg avatar Apr 02 '24 17:04 yaman-lunarg

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.

charles-lunarg avatar Apr 02 '24 17:04 charles-lunarg

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

yaman-lunarg avatar Apr 02 '24 17:04 yaman-lunarg

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

charles-lunarg avatar Apr 02 '24 18:04 charles-lunarg

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

yaman-lunarg avatar Apr 02 '24 18:04 yaman-lunarg

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.

charles-lunarg avatar Apr 02 '24 18:04 charles-lunarg

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

yaman-lunarg avatar Apr 02 '24 19:04 yaman-lunarg

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

charles-lunarg avatar Apr 02 '24 19:04 charles-lunarg

25.2.9519653 is probably related to Khronos Samples.

yaman-lunarg avatar Apr 02 '24 19:04 yaman-lunarg

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

yaman-lunarg avatar Apr 02 '24 21:04 yaman-lunarg

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.

mikes-lunarg avatar Aug 19 '24 20:08 mikes-lunarg