imnodes icon indicating copy to clipboard operation
imnodes copied to clipboard

Links with glew instead of gl3w by default

Open vyorkin opened this issue 3 years ago • 3 comments

Hello! I'm trying to build imnodes on Ubuntu 20.4. Here is what I do:

 premake5 gmake --sdl-include-path=/usr/include/SDL2 --sdl-link-path=/usr/lib

But I'm getting the linking errors:

/usr/bin/ld: ../../lib/Debug/libimgui.a(imgui_impl_opengl3.o): in function `ImGui_ImplOpenGL3_Init(char const*)':
/home/vyorkin/projects/github/cxx/imnodes/build/gmake/../../dependencies/imgui-1.80/imgui_impl_opengl3.cpp:160: undefined reference to `glGetIntegerv'
/

...

pl_opengl3.cpp:716: undefined reference to `__glewDeleteProgram'
collect2: error: ld returned 1 exit status

https://asciinema.org/a/Blq2Vpo40uu7KZsHrIpgaVVpo

vyorkin avatar Feb 19 '21 17:02 vyorkin

Hi @vyorkin ! Strange error, as the CI pipeline for this project runs in a ubuntu image, and doesn't seem to suffer from the same problem 🤔 I don't have access to ubuntu right now, but looking at the premake5.lua script, I can see that on Linux, we only do:

    filter "system:linux"
        links { "dl" }

Maybe we should also be linking agains -lgl? Could you try if modifying the script to this helps?

    filter "system:linux"
        links { "dl", "gl" }

Nelarius avatar Feb 28 '21 09:02 Nelarius

Thanks, @Nelarius, yes you're right, linking succeeds if I change it to:

    filter "system:linux"
        links { "dl", "GL", "GLEW }

For some reason, it tries to link with GLEW. Now I have another problem (segfault), which I'm trying to debug, here is the backtrace from gdb:

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000055e513fcedc5 in ImGui_ImplOpenGL3_CreateDeviceObjects () at ../../dependencies/imgui-1.80/imgui_impl_opengl3.cpp:669
#2  0x000055e513fcdd09 in ImGui_ImplOpenGL3_NewFrame () at ../../dependencies/imgui-1.80/imgui_impl_opengl3.cpp:242
#3  0x000055e513f7469a in main () at ../../example/main.cpp:92

Some more context:

668         const GLchar* vertex_shader_with_version[2] = { g_GlslVersionString, vertex_shader };
669         g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
670         glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
671         glCompileShader(g_VertHandle);
672         CheckShader(g_VertHandle, "vertex shader");

vyorkin avatar Mar 04 '21 22:03 vyorkin

I think it is related to #83

vyorkin avatar Mar 04 '21 22:03 vyorkin