build-example may fail linking with glu 9.0.2
Summary
With Mesa OpenGL utility library (GLU) version 9.0.2 installed, running make build-example can fail with error like undefined reference to symbol 'glEnd' or undefined reference to symbol 'glEnable'.
A complete output can be found here https://pastebin.com/ALfiRkw4
Details
This is an issue with glu version 9.0.2 and may affect different distributions (Archlinux in my case)
I added MAY because it only appear when building glu using meson and not make. Indeed while using meson the pkgconfig file generated is malformed and contains a Requires.private: opengl instead of Requires: opengl field. This lead to the command pkg-config --libs glu to ommit the -lGL argument. Hence a linking error.
This issue have already been fix on the glu repo with this commit We just have to wait for the next glu release.
Quick fix
A temporary fix while an official version is release is to edit Makefile.opengl and add a --static argument to pkg-config --libs glu commands
This gives:
LDFLAGS += ${shell pkg-config --libs --static glu} -lglut
Hello, after i've edited the Makefile.opengl, i got the errormessages that ld cannot find -lGLU and -lglut. I am driving archlinux as well, and it is uptodate. Are there any other errors, or is it my linux, are there other packeges i need to install?
Hi, I got the same problem with the build-parts part of the make process.
My system is Ubuntu 22.04 for reference.
The fix I adopted was:
CPPFLAGS += ${shell pkg-config --cflags glu gl}
LDFLAGS += ${shell pkg-config --libs glu gl} -lglut