Segmentation fault when creating a window

Hi there,
I’m new to GLFW, and I’m having problems getting started.
I want to create an OpenGL ES application for desktop (yes, ES). I’m using 64-bit linux. I have a standard installation of GLFW 3.2. When I try to create a window using this code:

#define GLFW_INCLUDE_ES3
#include <GLFW/glfw3.h>
GLFWwindow* createWindow(uint16_t width, uint16_t height, const char* title)
{
    bool init = glfwInit();
    if (!init)
    {
            return NULL;
    }
    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
    return glfwCreateWindow(width, height, title, NULL, NULL);
}

I get the following output:

GL renderer: [NVS 300/PCIe/SSE2]
GL vendor:[NVIDIA Corporation]
GL version: [3.3.0 NVIDIA 340.96]
GL shading language version: [3.30 NVIDIA via Cg compiler]
Segmentation fault (core dumped)

I think the problem is that I’m using NVidia driver 340.96, which does not support OpenGL ES. However, I have an OpenGL ES emulator - my own libGLESv2.so, libEGL.so, etc. Is there a way to make GLFW link/include these libraries (which as far as I can tell are the system default anyway)?

Thanks a lot!

Are you able to step through with a debugger to determine in which function+line the segfault occurs?

This is the output I get from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) backtrace 
#0  0x0000000000000000 in ?? ()
#1  0x0000000000408260 in parseVersionString (api=0x6ef8d0, major=0x6ef8d8, minor=0x6ef8dc, rev=0x6ef8e0)
    at /home/<USER>/Downloads/glfw-3.2/src/context.c:56
#2  0x0000000000408b69 in _glfwRefreshContextAttribs (ctxconfig=0x7fffffffdc00) at /home/<USER>/Downloads/glfw-    3.2/src/context.c:384
#3  0x000000000040d30a in glfwCreateWindow (width=640, height=480, title=0x41c9ef "Shader visualizer", monitor=0x0, share=0x0)
    at /home/<USER>/Downloads/glfw-3.2/src/window.c:207
#4  0x000000000040798e in createWindow (width=640, height=480, title=0x41c9ef "Shader visualizer")
    at <DIRECTORY>/Native.c:34
#5  0x00000000004079c8 in showVisualizer (environment=0x0, object=0x0)
    at <DIRECTORY>/Native.c:40
#6  0x0000000000407a92 in main () at <DIRECTORY>/Native.c:67
(gdb) frame 1
#1  0x0000000000408260 in parseVersionString (api=0x6ef8d0, major=0x6ef8d8, minor=0x6ef8dc, rev=0x6ef8e0)
    at /home/<USER>/Downloads/glfw-3.2/src/context.c:56
56        version = (const char*) window->context.GetString(GL_VERSION);

At this point, gdb says GL_VERSION and context have no symbol in the current context

Try it without setting GLFW_CONTEXT_CREATION_API.