Skip to content
Advertisement

ld fails to find glfw3

I’m trying to build the OpenGL Super Bible 7th edition code samples on Ubuntu 16.04. First I have to run cmake, which seems to work, and then I have to run make to compile.

I believe I have installed glfw3 and the Mesa OpenGL packages. When I execute cmake (after installing libglfw3 and libglfw3-dev), I get messages that OpenGL and GLFW3 have been found:

JavaScript

But when I execute make after cmake finishes, I get this error:

JavaScript

So I tried to see whether glfw3 was installed. I am a Linux newbie, so I found these commands online:

JavaScript

That spits out:

JavaScript

Whereas when I enter sudo pkg-config --libs glfw without a 3 on the end I get:

JavaScript

And I tried: sudo ldconfig -p | grep "glfw"

That spits out:

JavaScript

In contrast, sudo ldconfig -p | grep "glfw3" returns nothing.

Is this cmake file I downloaded set up incorrectly to tell the linker -lglfw3, when it should be telling it -lglfw? Or are my library paths somehow not correctly defined?

Advertisement

Answer

Bad/out-of-date CMakeLists.txt.

Line 28 of CMakeLists.txt is:

JavaScript

Should be:

JavaScript

Better yet they should probably be using find_package() to find GLFW.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement