gpt4 book ai didi

android - Vulkan API 示例构建失败

转载 作者:行者123 更新时间:2023-11-30 03:23:17 25 4
gpt4 key购买 nike

我正在按照以下说明操作: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;安卓工作室 3.1.2;NDK:r17;编译SDK: API 24: Android 7.0 (Nougat); Gradle 3.3

最佳答案

看起来问题出在 android NDK header 中。具体在:

Android/Sdk/ndk-bundle/sources/third_party/shaderc/include/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 以便它不会因该错误而出错?可能不是长期的解决方案...更好的解决方案是找出谁制作了第三方 header :shaderc.hpp 并请他们很好地修复它...

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

关于android - Vulkan API 示例构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50472588/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com