Seg fault in Vulkan enumerate physical device

I am following Learning Vulkan by Parminder Singh for learning graphics programming using Vulkan API. I have followed the guide for the device handshake correctly and the compilation is done. Only, it returns a segmentation fault at runtime. After debugging line by line, i have determined that the exact line at which this error occurs is in the Vulkan Application class’s member function where i call the vkEnumeratePhysicalDevice function :

VkResult VulkanApplication::enumeratePhysicalDevices(std::vector<VkPhysicalDevice>& gpuList)
{

    uint32_t gpuDeviceCount {};

    VkResult result = vkEnumeratePhysicalDevices(instanceObj.instance, &gpuDeviceCount, NULL);
    assert(result == VK_SUCCESS);

    gpuList.resize(gpuDeviceCount);
    assert(gpuDeviceCount);

    result = vkEnumeratePhysicalDevices(instanceObj.instance, &gpuDeviceCount, gpuList.data());
    assert(result == VK_SUCCESS);

    return result;
}

Here is the error message the debugger gives out:

82      VkResult result = vkEnumeratePhysicalDevices(instanceObj.instance, &gpuDeviceCount, NULL);
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f7fdfb in ?? () from /lib/x86_64-linux-gnu/libvulkan.so.1

I am using Vulkan 1.2.154.0, my system is Ubuntu 20.04, and the graphics card installed on my sydtem is Intel UHD Graphics 630

I can’t find any errors in the syntax or any other errors in the code, so I don’t know exctly how to rectify this. could use some help

Hard to say, but some things you could check:

  • can you run other vulkan programs (e.g. vulkaninfo, vkcube from the Vulkan SDK)? This would identify problems with your drivers.
  • is your instance valid?

I’m sorry, i actually had the sdk for the wrong release of vulkan. I solved it but the vkvia now gives the following message:

VIA_INFO:    SDK Found! - Will attempt to run tests
VIA_INFO:       Attempting to run vkcube in 
VIA_INFO:           Command-line: vkcube --c 100 --suppress_popups
/usr/bin/vkcube
VIA_INFO:           Command-line: vkcube --c 100 --suppress_popups --validate
/usr/bin/vkcube
ERROR : GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
	/usr/lib/i386-linux-gnu/libvulkan_intel.so: wrong ELF class: ELFCLASS32

	Objects - 1
		Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 0x55b6e5351ad0

ERROR : GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
	/usr/lib/i386-linux-gnu/libvulkan_radeon.so: wrong ELF class: ELFCLASS32

	Objects - 1
		Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 0x55b6e5351ad0

SUCCESS: Vulkan analysis completed properly using Vulkan 1.2

What are those errors? And how can i get rid of them?

Looks like it is picking up 32bit drivers and you are probably on a 64bit system or at least running a 64bit vkvia binary. I don’t know why that happens or how to fix it. You could check to only have the drivers that match your architecture installed, that way vkvia should not accidentally try to pick the wrong ones.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.