KomputeProject / kompute

General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
http://kompute.cc/
Apache License 2.0
1.88k stars 145 forks source link

Problem building Android example - unable to find library -lVulkan-Headers #356

Open math10 opened 5 months ago

math10 commented 5 months ago

Environment: OS: macOS 13.3 Android Studio: Android Studio Hedgehog | 2023.1.1 Patch NDK: 25.1.8937393 cmake: 3.22.1 Branch: #v0.9.0

Error:

What went wrong: Execution failed for task ':app:buildCMakeDebug[arm64-v8a]'. com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/.cxx/Debug/w4f86y3s/arm64-v8a' [1/23] Generating ShaderLogisticRegression.hpp [2/23] Generating ShaderOpMult.hpp [3/23] Compile vulkan compute shader from file '/Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/src/main/cpp/shader/my_shader.comp' to '/Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/.cxx/Debug/w4f86y3s/arm64-v8a/shader/my_shader.comp.spv'. /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/src/main/cpp/shader/my_shader.comp [4/23] Building CXX object kompute_build/src/logger/CMakeFiles/kp_logger.dir/Logger.cpp.o [5/23] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/os.cc.o [6/23] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o [7/23] Linking CXX static library _deps/fmt-build/libfmtd.a [8/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/OpTensorSyncLocal.cpp.o [9/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/OpMemoryBarrier.cpp.o [10/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/OpAlgoDispatch.cpp.o [11/23] Converting compiled shader '/Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/.cxx/Debug/w4f86y3s/arm64-v8a/shader/my_shader.comp.spv' to header file '/Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/.cxx/Debug/w4f86y3s/arm64-v8a/shader/my_shader.hpp'. -- Interpreting shader in little endian... [12/23] Linking CXX static library kompute_build/src/logger/libkp_logger.a [13/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/OpTensorSyncDevice.cpp.o [14/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/OpTensorCopy.cpp.o [15/23] Building CXX object CMakeFiles/kompute-jni.dir/KomputeJniNative.cpp.o [16/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/Sequence.cpp.o [17/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/Tensor.cpp.o [18/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/Algorithm.cpp.o [19/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/Core.cpp.o [20/23] Building CXX object kompute_build/src/CMakeFiles/kompute.dir/Manager.cpp.o [21/23] Linking CXX static library kompute_build/src/libkompute.a [22/23] Building CXX object CMakeFiles/kompute-jni.dir/KomputeModelML.cpp.o [23/23] Linking CXX shared library /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/build/intermediates/cxx/Debug/w4f86y3s/obj/arm64-v8a/libkompute-jni.so FAILED: /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/build/intermediates/cxx/Debug/w4f86y3s/obj/arm64-v8a/libkompute-jni.so : && /Users/sanim/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android26 --sysroot=/Users/sanim/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libkompute-jni.so -o /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/build/intermediates/cxx/Debug/w4f86y3s/obj/arm64-v8a/libkompute-jni.so CMakeFiles/kompute-jni.dir/KomputeJniNative.cpp.o CMakeFiles/kompute-jni.dir/KomputeModelML.cpp.o kompute_build/src/libkompute.a -llog -landroid -lVulkan-Headers kompute_build/src/logger/libkp_logger.a _deps/fmt-build/libfmtd.a -lVulkan-Headers -latomic -lm && : ld: error: unable to find library -lVulkan-Headers ld: error: unable to find library -lVulkan-Headers clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. C++ build system [build] failed while executing: /Users/sanim/Library/Android/sdk/cmake/3.22.1/bin/ninja \ -C \ /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app/.cxx/Debug/w4f86y3s/arm64-v8a \ kompute-jni from /Users/sanim/Documents/UGA/Labwork/kompute/examples/android/android-simple/app

axsaucedo commented 5 months ago

This library is included as part of the build and fetched using github as part of the cmake build. This has not been tested in mac, but has been tested in windows, can you check your build/_deps folder to confirm that vulkan-headers is located there?

math10 commented 5 months ago

I didn't see any vulkan-headers in _deps folder and its subfolders. Please see the attached image those are the things that are available in the _deps folder. Could you please let me know, Is there any cmake configs which are specific to windows?

FYI, I have also tested on ubuntu same error found. Screenshot 2024-02-11 at 1 27 00 PM

math10 commented 5 months ago

@axsaucedo Do you have any idea seeing the attached picture from the previous comment?

axsaucedo commented 5 months ago

Thank you for the followup message @math10, it seems I missed the notification - looking at the picture I can see that indeed there are dependencies missing - as you should see something more like the following:

image

Looking at the logs provided I don't see anything incorrect so far - could you run a clean and then a rerun to see if that helps? Having a verbose CMAKE could also help to understand what may be the issue when fetching the dependencies. It would be useful if you can also share the logs that show the variables set on the cmake build.