Vulkan 验证层无法在 Linux 上加载/工作 [英] Vulkan validation layers don't load/work on Linux
问题描述
我有基本的 Vulkan 应用程序Hello triangle",源自本教程.在调试模式下,我使用两个验证层:
I have basic Vulkan application, "Hello triangle",derived from this tutorial. In debug mode I use two validations layers:
VK_LAYER_KHRONOS_validation
和 VK_LAYER_LUNARG_monitor
在 Windows 上我没有问题.两个层都加载了,我可以在标题栏中看到 FPS 计数器.但是我在 Linux (Ubuntu 18.04) 上遇到了不同的行为.
On Windows I got no problem. Both layers load, I can see FPS counter in the title bar. But I am experiencing different behaviour on Linux (Ubuntu 18.04).
仅加载 VK_LAYER_LUNARG_monitor
.标题栏中不显示 FPS 计数器.
Only VK_LAYER_LUNARG_monitor
loads. No FPS counter appears in the title bar.
VK_LAYER_KHRONOS_validation
无法加载并显示错误:
VK_LAYER_KHRONOS_validation
fails to load with the error:
错误:libVkLayer_khronos_validation.so:无法打开共享对象文件:没有那个文件或目录
ERROR: libVkLayer_khronos_validation.so: cannot open shared object file: No such file or directory
我根据此 LunarG 文档中出现的指南执行了 Linux 设置.
I performed Linux setup according to the guidelines appearing in this LunarG doc.
- 将整个 LunarG SDK 放在我的 Linux 上的任意位置文件系统.
- 将
setup-env.sh
导入.profile
文件 - 在 setup-env.sh 脚本中,我还添加了
VK_LOADER_DEBUG=all
以查看来自 Vulkan Loader 的详细信息. - 验证脚本设置的所有变量是否指向 SDK 中的正确目录.
- Put the whole LunarG SDK in an arbitrary location on my Linux filesystem.
- Sourced
setup-env.sh
into.profile
file - Inside the setup-env.sh script I also added
VK_LOADER_DEBUG=all
in order to see detailed info from Vulkan Loader. - Verified that all the variables set by the script point to correct directories in the SDK. They do.
setup-env.sh:
setup-env.sh:
VULKAN_SDK="$(dirname "$(readlink -f "${BASH_SOURCE:-$_}" )" )/x86_64"
export VULKAN_SDK
PATH="$VULKAN_SDK/bin:$PATH"
export PATH
LD_LIBRARY_PATH="$VULKAN_SDK/lib:${LD_LIBRARY_PATH:-}"
export LD_LIBRARY_PATH
VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d"
export VK_LAYER_PATH
export VK_LOADER_DEBUG=all
这是我从调试输出中得到的显示加载层失败的块:
Here is the chunk I am gettin from debug output that show the failure of loading the layers:
DEBUG:加载图层库/home/platform-thirdparty/vulkan-sdk/1.1.121.1/x86_64/lib/libVkLayer_monitor.so信息:插入的设备层 VK_LAYER_LUNARG_monitor(/home/platform-thirdparty/vulkan-sdk/1.1.121.1/x86_64/lib/libVkLayer_monitor.so)消息:libVkLayer_khronos_validation.so:无法打开共享对象文件:没有这样的文件或目录错误:libVkLayer_khronos_validation.so:无法打开共享对象文件:否这样的文件或目录
DEBUG: Loading layer library /home/platform-thirdparty/vulkan-sdk/1.1.121.1/x86_64/lib/libVkLayer_monitor.so INFO: Inserted device layer VK_LAYER_LUNARG_monitor (/home/platform-thirdparty/vulkan-sdk/1.1.121.1/x86_64/lib/libVkLayer_monitor.so) Message:libVkLayer_khronos_validation.so: cannot open shared object file: No such file or directory ERROR: libVkLayer_khronos_validation.so: cannot open shared object file: No such file or directory
尽管它这么说
插入设备层 VK_LAYER_LUNARG_monitor
Inserted device layer VK_LAYER_LUNARG_monitor
显示器不工作.如果我将 VK_LAYER_KHRONOS_validation
替换为 VK_LAYER_LUNARG_standard_validation
,我会收到相同的加载失败错误.调试器还显示加载器确实找到了 SDK 中所有层的所有清单文件.我不知道还有什么可能是问题.
The monitor doesn't work.
If I replace VK_LAYER_KHRONOS_validation
with VK_LAYER_LUNARG_standard_validation
I am getting the same load fail error.
The debugger also shows that the loader did find all the manifest files for all the layers in the SDK.
I have no clue what else can be a problem.
我的系统设置:
Ubuntu 18.04 64 位,Nvidia RTX 3000英伟达驱动:430.0VulkanSDK(LunarG):1.1.121.1
Ubuntu 18.04 64bit, Nvidia RTX 3000 Nvidia Drivers: 430.0 VulkanSDK(LunarG): 1.1.121.1
推荐答案
在这个 SO question 是 user1824407 的答案.
In this SO question lies the answer by user1824407.
似乎在最新的 Ubuntu 发行版中(至少在我使用的 18.04 中)将 LD_LIBRARY
路径设置为配置文件,例如:.profile
或 /etc/environment
或 .bashrc
It appears that in the latest Ubuntu distributions (at least in 18.04 I use) setting LD_LIBRARY
path into config files like:
.profile
or /etc/environment
or .bashrc
没有任何效果.事实上,我尝试将 lib 路径添加到所有这些文件中,即使 echo $LD_LIBRARY_PATH
打印了我设置的通行证,lib 也没有加载.并且仅当我将带有 Vulkan 验证层位置的路径添加到 /etc/ld.so.conf.d/devlibs.conf
where
Doesn't take any effec.And indeed,I tried adding the lib path to all of those files, the libs didn't load even that echo $LD_LIBRARY_PATH
printed the pass I set.
And only when I added the path with the Vulkan validation layers location to /etc/ld.so.conf.d/devlibs.conf
where
devlibs.conf
devlibs.conf
是我给文件的任意名称,现在我看到 VK_LAYER_LUNARG_monitor 和 VK_LAYER_KHRONOS_validation 都由 Vulkan 加载.
is an arbitrary name I gave the file,now I see both VK_LAYER_LUNARG_monitor and VK_LAYER_KHRONOS_validation are loaded by Vulkan.
这篇关于Vulkan 验证层无法在 Linux 上加载/工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!