If by chance you are using CERN’s ROOT (local build) and try to build to kicad from source, you might face a compilation error.
error: ‘GL_GEOMETRY_SHADER’ was not declared in this scope
This is because in my bashrc I had ‘source /opt/root/bin/thisroot.sh’ which sets some env variables, point to a file GL/glew.h that is different from the latest one used by KiCAD.
So remove that from the bashrc before building