root_v6.24.08-source/graf3d/gl/inc/TX11GL.h:27:10: fatal error: GL/glx.h: No such file or directory

When compiling ROOT from within MEGALIB I get

[ 97%] Building CXX object graf3d/gl/CMakeFiles/G__RGL.dir/G__RGL.cxx.o
In file included from /home/QC_user2/MEGAlib/external/root_v6.24.08/root_v6.24.08-build/graf3d/gl/G__RGL.cxx:119:
/home/QC_user2/MEGAlib/external/root_v6.24.08/root_v6.24.08-source/graf3d/gl/inc/TX11GL.h:27:10: fatal error: GL/glx.h: No such file or directory
27 | #include <GL/glx.h>

_ROOT Version: 6.24.08
_Platform: CentOS6
_Compiler: x86_64-conda-linux-gnu-c++

Dear @ziggy ,

I am unsure about MEGALIB, but I discourage you from building ROOT from source unless strictly necessary. There are better installation options at Installing ROOT - ROOT

I’ve never seen this message, and it shouldn’t be necessary for building ROOT. But, in any case, you can check which package is missing. For example on ubuntu

root@9cbfb15f866b:/# apt-file search "glx.h"
libglx-dev: /usr/include/GL/glx.h

So you can just install it and it should work then. In general, make sure you have installed all the dependencies before building ROOT Dependencies - ROOT .


Hi @ziggy,

As @vpadulan mentioned, building ROOT from sources is discouraged for regular users, and unless justified otherwise, binary packages should be used instead.

However, if you need to build ROOT including OpenGL support, you will need to install the libgl (or libglvnd), and glu packages. The names may slightly vary depending on your GNU/Linux distribution.
Otherwise, if you think you can opt out this component, you can add -Dopengl=OFF to the CMake command line.

In any case, I’d recommend going for a binary pre-compiled package, unless you have a very good reason not to.


Well I need ROOT version 6.24.08 or above compiled with C++11. As far as I know the ROOT binaries are compiled with C++17, or is there a binary which was compiled with C++11?

The last ROOT version compiled with C++11 support is ROOT 6.24. The current supported version is C++14 and in the next ROOT release (Q4 2023) it will move to C++17.

I suggest you very strongly to move your project to more recent C++ standard versions. Otherwise you are only left with the option of compiling software on your own (this is not true only for ROOT but many other packages).


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.