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.94k stars 146 forks source link

Android sample is not compiling #305

Closed mukovozov closed 1 year ago

mukovozov commented 1 year ago

I'm really excited about your project, cause it may help us to overcome CPU restrictions, but, unfortunately, I'm not able to build the Android sample.

I'm getting an error message like this:

.../android-simple/app/src/main/cpp/CMakeLists.txt : C/C++ arm8Debug|arm64-v8a : CMake Error at 
...kompute/examples/android/android-simple/app/src/main/cpp/../../../../../../../src/CMakeLists.txt:73 (add_subdirectory):
  The source directory

.../kompute/external/Vulkan-Headers

  does not contain a CMakeLists.txt file.

I assume the problem is in this line: add_subdirectory(../../../../../../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build).
I've tried to replace it with includeDirectories(absolute path to kompute directory), but then I see many other compilation errors.

I'm not very experienced in NDK and building C libraries in general, so maybe you could advise me something because I've seen that you have tested the Android sample recently and it worked for you.

axsaucedo commented 1 year ago

Great to hear about the interest on the project. There may be a couple of things to set up to get up and running.

@mukovozov you will need to make sure to initialise all the git submodules, you can do so through git submodule update --init --recursive

mukovozov commented 1 year ago

thanks for a quick reply!
Yeah, I did it manually before, but now I can see other issues as:

kompute/VERSION:1:1: error: expected unqualified-id
sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace

and more.
I use the NDK version that is defined in build.gradle file.

axsaucedo commented 1 year ago

Ok I see, another thing that I can think about looking at the issue, it may be potentially a couple of things to consider. Indeed as you suggested the first most important things are to ensrue that the version of NDK is the correct one, as well as the version of the android development setup. Further to that it may be worth ensuing that the vulkan headers / packages are of the correct version.

axsaucedo commented 1 year ago

Having said that, I'm not sure why the VERSION file is appearing as an error, that should not really be a file that would be compiled / processed

mukovozov commented 1 year ago

I've managed to fix those issues, that was my fault most likely.
Regarding Vulkan headers version, I see sources, but I cannot find any version file there. Anyway, I think I cloned versions that you specified (fmt, vulkan, etc.). It seems like I need to specify c++14 features, but I see it's done in CMakeLists.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 \
                     -DVK_USE_PLATFORM_ANDROID_KHR=1 \
                     -DKOMPUTE_DISABLE_VK_DEBUG_LAYERS=1")

Screen Shot 2022-09-19 at 9 41 40

mukovozov commented 1 year ago

Oh, I've launched the app! I've changed type from auto to std::string and removed value from vk::Pipeline pipeline = this->mDevice->createComputePipeline(*this->mPipelineCache, pipelineInfo).value;

mukovozov commented 1 year ago

I'm closing the issue due to I've managed to build the app and the errors were probably specific and there is no need to fix anything from your side. Thanks for the response anyway!