Android Vulkan API示例构建失败

Android Vulkan API示例构建失败,android,c++,android-ndk,vulkan,Android,C++,Android Ndk,Vulkan,我遵循以下指示: 编译任何模块时,都会出现以下错误: 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/.externalNativeB

我遵循以下指示: 编译任何模块时,都会出现以下错误:

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.
Build命令失败。
执行process/home/sophour/Android/Sdk/cmake/3.6.4111459/bin/cmake时出错,参数为{--build/home/sophour/Code/Android/VulkanAPIsamples/API Samples/Android/texel_buffer/.externalNativeBuild/cmake/debug/x86--target vulkan_sample}
[1/5]构建CXX对象utils/CMakeFiles/vsamputils.dir/util.cpp.o
失败:/home/sophour/Android/Sdk/ndk bundle/toolschains/llvm/prebuild/linux-x86_64/bin/clang++--target=i686 none-linux-Android--gcc-toolschain=/home/sophour/Android/Sdk/ndk bundle/toolschains/x86-4.9/prebuild/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/utils//安卓/vulkan_包装器-I/home/sophour/Code/Android/VulkanAPIsamples/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/cx stl/gnu libstdc++/4.9/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\u-Android\u=24-g-DANDROID-fffunction-sections-funwind-tables-fstack-protector-strong-无规范前缀-mstackreallign-Wa,--noexecstack-Wformat-Werror=format security-std=c++11-Werror-DVK\u USE\u PLATFORM\u KHR-O0-fno limit debug info-fPIC-MD-MT utils/CMakeFiles/vsamputils.dir/util.cpp.o-MF utils/CMakeFiles/vsamputils.dir/util.cpp.o-c/home/sophour/Code/Android/VulkanAPIsamples/API Samples/utils/util.cpp
在/home/sophour/Code/Android/VulkanAPIsamples/API Samples/utils/util.cpp:40中包含的文件中:
在/home/sophour/Android/Sdk/ndk bundle/sources/third_party/shaderc/include/shaderc/shaderc.hpp中包含的文件中:18:
在/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:错误:对抽象但具有非虚拟析构函数[-Werror,-Wdelete非虚拟dtor]的“shaderc::CompileOptions::IncluderInterface”调用delete
删除uu ptr;
^
/home/sophour/Android/Sdk/ndk bundle/sources/cxx stl/gnu libstdc++/4.9/include/bits/unique_ptr.h:236:4:注意:在成员函数“std::default_delete::operator()”的实例化中,此处请求
get_deleter()(u ptr);
^
/home/sophour/Android/Sdk/ndk bundle/sources/third_party/shaderc/include/shaderc/shaderc.hpp:133:3:注意:在成员函数“std::unique_ptr::~unique_ptr”的实例化中,此处请求
CompileOptions(){options_u=shaderc_compile_options_initialize()}
^
生成1个错误。
忍者:构建停止:子命令失败。
我对这一点完全是新手,没有本地android开发的经验。请帮我解决这个问题!A我的论文非常需要它

Ubuntu 14.04; 安卓工作室3.1.2; NDK:r17; 编译SDK:API24:Android7.0(牛轧糖);
Gradle 3.3

问题似乎出在android NDK头中。具体而言:

Android/Sdk/ndk bundle/sources/third_party/shaderc/include/shaderc/shaderc.hpp

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

  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非虚拟dtor或-Werror,这样它就不会因该错误而出错?可能不是一个长期的解决方案。。。更好的解决方案是找出谁制作了第三方标题:shaderc.hpp,并要求他们很好地修复它


其他选项是在JavaSDK中使用OpenGL,或者从scrap编写Vulkan部分,而不使用示例代码。我最近编写了一个使用Vulkan的android应用程序,但没有遇到这个错误。

首先,获取最新的源代码。(最初我直接从android studio导入样本,这些样本的日期为2017年7月)。我已经按照github上的说明进行了操作,但没有效果。同样的错误(在我安装了git cmake build essential bison libx11 xcb dev libxkbcommon dev libmirclient dev libwayland dev libxrandr dev之后,安装了一些缺少的软件包,但也没有任何帮助。问题似乎出在shaderc中,但当我执行
$../../../ndk build ndk_PROJECT_PATH=.APP_build_SCRIPT=Andro时id.mk APP_STL:=gnustl_static APP_ABI=all NDK_TOOLCHAIN_VERSION:=clang libshaderc_combined-j16
一切正常顺便说一句,libshaderc的最新版本已经解决了这个问题。新的标题可以在以下网址查看:谢谢你,@cerulean_quasar征求你的意见,但是你指的是什么文件呢?
/home/sophour/Android/Sdk/cmake/3.6.4111459/bin/cmake
?如果由android studio负责,我如何删除
-Wdelete非虚拟dtor或-Werror
键?我还尝试git克隆和构建shaderc最新版本,并在对源目录安排进行了一些调整后成功构建了它,但gradle从未完成构建示例。以及替换旧版本shaderc.hpp与新版本也没有帮助)它们在导致错误的部分是相同的。我很困惑…稍后我将尝试从头开始制作vulkan应用程序,但如果有人提出其他建议,请分享它们。以下是一个非常好的建议。你不需要这样做