GLFW / Vulkan init error

g++ 5.4.0

GNU Make 4.1

GLFW 3.2.1

Vulkan 1.0.8

Ubuntu 16.04


I started a vulkan project and I use glfw for window / surface stuff. everything works great so far but when I try to create a surface via glfwCreateWindowSurface() I recieve the following error:

“Vulkan: Window surface creation extensions not found”

glfwGetRequiredInstanceExtensions() returns NULL, and number of extensions is 0. So I know thats the exact error.

this is the window creation code:

this is the vk instance creation code:

instance creation

this is the surface creation call:

surface call

All 3 functions are called in the order I mentioned them. So the strange thing is:

  • glfwVulkanSupported() returns true!
  • vkEnumerateInstanceExtensionProperties() gives an output of:

So the extension I need is there (VK_KHR_surface)! I read the glfw reference of glfwGetRequiredInstanceExtensions() and it doesn’t offer any help really, 'cause everything that could fail, works… the only thing mentioned on the reference page is:

If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns NULL. You may still use Vulkan for off-screen rendering and compute work.

… okay… but I do want to render on-screen :smiley:
So any help or guesses?

Have you tried compiling and running the vulkan.c test code for GLFW?

Note: It’s easier for us if you post code as text see for an example of how to format code blocks.


thanks for that quick reply. I tried the example and recieved:

glfwGetRequiredInstanceExtensions failed to find the platform surface extensions.

Do you have a compatible Vulkan installable client driver (ICD) installed?
Please look at the Getting Started guide for additional information.

so is there anything I can do?

btw: I tried to post the code as a text but I didn’t find the code posting option. and c code is not really html.

To post code just add four spaces at the start of each line.

Your installation of vulkan should come with a vulkaninfo command, can you run that and also detail which GPU and driver you’re using?


I’m using a NVIDIA GEFORCE GT 710, driver: NVIDIA binary driver - version 364.16 from nvidia-364 (open source)
I checked support before I started developing and my graphics card does support vulkan.

vulkaninfo output is quite long. I posted the SDK version before. But here is the whole output:
vulkan output

(too long for a forum post I guess)

I also tried to install a driver from that page first, which didn’t work on ubuntu really:
vulkan driver
But ubuntu offered recent (mentioned above) driver, which does support vulkan.

So it looks like Vulkan is correctly installed, but you only have the XCB surface and not an XLIB one.

The required extension code on X11 uses this function which for VK_KHR_xcb_surface needs an x11 xcb handle, which is discovered here in the x11 handle.

So my guess is that you’re missing - if this isn’t the case it would have handy to put breakpoints in the above functions to see what’s happening.

well is located in /usr/lib/x86_64-linux-gnu. so I guess that one is available?
I read in another forum that someone had the same error appearing. but it turned out that he called window creation after instance creation, which caused the error. but in my case it’s different. isn’t there any easy stupid mistake I could’ve done, before debugging glfw…?


I tried to change both mentioned functions a bit to give an output, wether parts of them would be executed:

char** _glfwPlatformGetRequiredInstanceExtensions(uint32_t* count)
char** extensions;

*count = 0;
if (!_glfw.vk.KHR_xcb_surface || !_glfw.x11.x11xcb.handle)
    if (!_glfw.vk.KHR_xlib_surface)
        {return NULL;printf("couldn't load xlib\n");}
extensions = calloc(2, sizeof(char*));
extensions[0] = strdup("VK_KHR_surface");
if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle)
    {extensions[1] = strdup("VK_KHR_xcb_surface");printf("xcb\n");}
    {extensions[1] = strdup("VK_KHR_xlib_surface");printf("xlib\n");}
*count = 2;
return extensions;



_glfw.x11.x11xcb.handle = dlopen(“”, RTLD_LAZY | RTLD_GLOBAL);
if (_glfw.x11.x11xcb.handle)
_glfw.x11.x11xcb.XGetXCBConnection = (XGETXCBCONNECTION_T)
dlsym(_glfw.x11.x11xcb.handle, “XGetXCBConnection”);
{printf(“couldn’t open\n”);}

ran cmake, make, installed it… but it didn’t seem to apply the changes… I didn’t recieve any output… so I’m really stucked in creating the window surface :pensive:

It’s possible for your code to not call the printf’s but still fail to provide any required extensions.

I would either debug the code with a debugger, or add printf debugging on paths where you’re guaranteed to have the code execute such as at the start of the function or before every return.

Snatching this thread a little… :slight_smile:

I’m having a similar problem… glfwInit works fine, glfwGetRequiredInstanceExtensions() returns NULL, glfwVulkanSupported() returns false.

Still, the Vulkan samples (that come with the Vulkan SDK) works fine, and vulkaninfo seems to work fine too.

I’m thinking it has something to do with the vulkan loader?

On ubuntu 14.04, GTX840M, nvidia drivers 367.44, GLFW 3.2.1 (using cmake).
I should say also im running the same project on windows through Visual Studio, which works FINE (on another PC though, with a GTX970).

Have you been able to debug the two sections of code I linked to above to see what’s going on?

I worked for a bit to get vulkan.c to run. It seems i wasn’t linking to libvulkan properly (i had thought glfw did that for me). Anyway, after getting vulkan.c to run, my project runs too :slight_smile: Thanks for the help!