繁体   English   中英

Vulkan API样本构建失败

[英]Vulkan API samples building fails

我正在按照以下说明进行操作: https : //developer.android.com/ndk/guides/graphics/getting-started并在编译任何模块时使gettig出现以下错误:

Build command failed.
Error while executing process /home/sophour/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/sophour/Code/Android/VulkanAPIsamples/API-Samples/android/texel_buffer/.externalNativeBuild/cmake/debug/x86 --target vulkan_sample}
[1/5] Building CXX object utils/CMakeFiles/vsamputils.dir/util.cpp.o
FAILED: /home/sophour/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=i686-none-linux-android --gcc-toolchain=/home/sophour/Android/Sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/home/sophour/Android/Sdk/ndk-bundle/sysroot   -I/home/sophour/Code/Android/API-Samples/data -I/home/sophour/Android/Sdk/ndk-bundle/sources/third_party/shaderc/third_party/glslang -I/home/sophour/Code/Android/VulkanAPIsamples/API-Samples/utils -I/home/sophour/Android/Sdk/ndk-bundle/sources/android/native_app_glue -I/home/sophour/Code/Android/VulkanAPIsamples/API-Samples/utils/../android/vulkan_wrapper -I/home/sophour/Code/Android/VulkanAPIsamples/API-Samples/utils/../data -I/home/sophour/Android/Sdk/ndk-bundle/sources/third_party/shaderc/include -isystem /home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem /home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /home/sophour/Android/Sdk/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=24 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security   -std=c++11  -Werror -DVK_USE_PLATFORM_ANDROID_KHR -O0 -fno-limit-debug-info  -fPIC -MD -MT utils/CMakeFiles/vsamputils.dir/util.cpp.o -MF utils/CMakeFiles/vsamputils.dir/util.cpp.o.d -o utils/CMakeFiles/vsamputils.dir/util.cpp.o -c /home/sophour/Code/Android/VulkanAPIsamples/API-Samples/utils/util.cpp
In file included from /home/sophour/Code/Android/VulkanAPIsamples/API-Samples/utils/util.cpp:40:
In file included from /home/sophour/Android/Sdk/ndk-bundle/sources/third_party/shaderc/include/shaderc/shaderc.hpp:18:
In file included from /home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/memory:81:
/home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/unique_ptr.h:76:2: error: delete called on 'shaderc::CompileOptions::IncluderInterface' that is abstract but has non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
        delete __ptr;
        ^
/home/sophour/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/unique_ptr.h:236:4: note: in instantiation of member function 'std::default_delete<shaderc::CompileOptions::IncluderInterface>::operator()' requested here
          get_deleter()(__ptr);
          ^
/home/sophour/Android/Sdk/ndk-bundle/sources/third_party/shaderc/include/shaderc/shaderc.hpp:133:3: note: in instantiation of member function 'std::unique_ptr<shaderc::CompileOptions::IncluderInterface, std::default_delete<shaderc::CompileOptions::IncluderInterface> >::~unique_ptr' requested here
  CompileOptions() { options_ = shaderc_compile_options_initialize(); }
  ^
1 error generated.
ninja: build stopped: subcommand failed.

我对此绝对是新手,没有原生Android开发经验。 请帮我解决这个问题! 我的论文迫切需要它!

Ubuntu 14.04; Android Studio 3.1.2; NDK:r17; 编译SDK:API 24:Android 7.0(牛轧糖); 摇篮3.3

看来问题出在android NDK标头中。 具体在:

机器人/ SDK / NDK束/源/ THIRD_PARTY / shaderc /包含/ shaderc / shaderc.hpp

他们将shaderc :: CompileOptions :: IncluderInterface声明为虚拟类,但没有虚拟析构函数:

  class IncluderInterface {
      public:
      // Handles shaderc_include_resolver_fn callbacks.
      virtual shaderc_include_result* GetInclude(const char* requested_source,
                                           shaderc_include_type type,
                                           const char* requesting_source,
                                           size_t include_depth) = 0;

      // Handles shaderc_include_result_release_fn callbacks.
      virtual void ReleaseInclude(shaderc_include_result* data) = 0;
  };

我通常不建议这样做,但看来您别无选择。 您可以从make文件中删除-Wdelete-non-virtual-dtor或-Werror,以便不会因该错误而出错? 长期来看可能不是解决方案。更好的解决方案是找出谁制作了第三方标头:sharcrc.hpp并很好地要求他们修复它...

其他选择是在Java SDK中使用OpenGL,或从废品中写入Vulkan零件,而不使用示例代码。 我最近写了一个使用Vulkan的android应用,但没有遇到此错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM