User avatar
Paeryn
Posts: 2229
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Fri Oct 14, 2016 9:12 pm

OMID-313 wrote: 1. Which libraries and dependencies did you install before building with cmake and make? Anything else than those I listed above? Or maybe I shouldn't install them !!?
Out of the ones you listed the only one I know I have would the build-essentials. I have quite a few -dev packages installed for various things but most of the ones you listed I probably haven't got (I'll check when I get home). None of them should prevent EGL/OpenGLES loading.
OMID-313 wrote: 2. Which commands do I have to run with sudo and which ones without sudo !?
Only ones that require root privileges need sudo, things like installing with apt-get, or make install when installing anywhere other than into directories that you own. If you use sudo when doing things like git, cmake and make then you will end up with files and directories owned by root.
OMID-313 wrote: 3. Did you use Raspbian Jessie as the OS !?
4. Do I have to enable or install any special library or package about graphics or OpenGL !?
Yes to 3, and no to 4.
She who travels light — forgot something.

User avatar
Paeryn
Posts: 2229
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 12:37 am

Update to list which packages out of the ones you installed that I have when I built Urho3D:

These I have:
build-essential, git, cmake, make, libevdev2

These I don't have:
freeglut3, freeglut3-dev, unixodbc-dev, libasound2-dev, libaudio-dev, libesd0-dev, libpulse-dev, libroar-dev, libreadline6-dev

Out of these libasound2, libaudio, libesd0, libpulse and libroar are audio libraries. unixodbc is a data source library (for a unified way of connecting to various databases etc). readline6 is for handling command-line style line editing. None of these should have any influence on EGL failing. Not having them just means that the parts of Urho3D that they affect don't work, so my build won't play audio because I haven't got the relevant libraries that it uses (or at least I haven't got the files needed to compile programs that use those libraries which is what the *-dev packages are).

As for freeglut3, that is an OpenGL toolkit that mainly supplies a standard interface for opening windows and handling input. As far as I can see Urho3D doesn't make use of it in any way. I can't see it mentioned on the Urho3D site and the only references to glut in the whole of the source code are in comments in SDL. Having freeglut3 installed shouldn't affect anything since it isn't used.
She who travels light — forgot something.

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 5:41 am

Paeryn wrote:Update to list which packages out of the ones you installed that I have when I built Urho3D:

These I have:
build-essential, git, cmake, make, libevdev2

These I don't have:
freeglut3, freeglut3-dev, unixodbc-dev, libasound2-dev, libaudio-dev, libesd0-dev, libpulse-dev, libroar-dev, libreadline6-dev

Out of these libasound2, libaudio, libesd0, libpulse and libroar are audio libraries. unixodbc is a data source library (for a unified way of connecting to various databases etc). readline6 is for handling command-line style line editing. None of these should have any influence on EGL failing. Not having them just means that the parts of Urho3D that they affect don't work, so my build won't play audio because I haven't got the relevant libraries that it uses (or at least I haven't got the files needed to compile programs that use those libraries which is what the *-dev packages are).

As for freeglut3, that is an OpenGL toolkit that mainly supplies a standard interface for opening windows and handling input. As far as I can see Urho3D doesn't make use of it in any way. I can't see it mentioned on the Urho3D site and the only references to glut in the whole of the source code are in comments in SDL. Having freeglut3 installed shouldn't affect anything since it isn't used.
Thanks a billion @Paeryn for your excellent information.
I'm installing the Urho3D again right now, and will tell you the result.

One more question:
Would you please check if you have libgles2-mesa-dev installed or not !? (Or any other mesa-related or graphics-related libraries?)

Thanks again.

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 8:16 am

Paeryn wrote:Update to list which packages out of the ones you installed that I have when I built Urho3D:

These I have:
build-essential, git, cmake, make, libevdev2

These I don't have:
freeglut3, freeglut3-dev, unixodbc-dev, libasound2-dev, libaudio-dev, libesd0-dev, libpulse-dev, libroar-dev, libreadline6-dev

Out of these libasound2, libaudio, libesd0, libpulse and libroar are audio libraries. unixodbc is a data source library (for a unified way of connecting to various databases etc). readline6 is for handling command-line style line editing. None of these should have any influence on EGL failing. Not having them just means that the parts of Urho3D that they affect don't work, so my build won't play audio because I haven't got the relevant libraries that it uses (or at least I haven't got the files needed to compile programs that use those libraries which is what the *-dev packages are).

As for freeglut3, that is an OpenGL toolkit that mainly supplies a standard interface for opening windows and handling input. As far as I can see Urho3D doesn't make use of it in any way. I can't see it mentioned on the Urho3D site and the only references to glut in the whole of the source code are in comments in SDL. Having freeglut3 installed shouldn't affect anything since it isn't used.
I did as you said @Paeryn.
I used git, cmake and make without sudo.
Then I used a separate build directory for building.
But still the same error !!

What should I do !!!!!???!?!?? :cry:

User avatar
Paeryn
Posts: 2229
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 10:56 am

You don't need gles2-mesa unless you use the experimental opengl (or want software opengl). As far as I'm aware Urho3D should still load the broadcom libraries even if the mesa ones are on your system.

What does the following command say the path for libGLESv2.so and libEGL.so is?

Code: Select all

ldd Urho3DPlayer 
Hopefully they should both be listed as in /opt/vc/lib/

If you have the mesa ones you could try forcing the use of the broadcom ones,

Code: Select all

LD_PRELOAD=/opt/vc/lib/libEGL.so:/opt/vc/lib/libGLESv2.so ./Urho3DPlayer 
She who travels light — forgot something.

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 11:37 am

Paeryn wrote:You don't need gles2-mesa unless you use the experimental opengl (or want software opengl). As far as I'm aware Urho3D should still load the broadcom libraries even if the mesa ones are on your system.

What does the following command say the path for libGLESv2.so and libEGL.so is?

Code: Select all

ldd Urho3DPlayer 
Hopefully they should both be listed as in /opt/vc/lib/

If you have the mesa ones you could try forcing the use of the broadcom ones,

Code: Select all

LD_PRELOAD=/opt/vc/lib/libEGL.so:/opt/vc/lib/libGLESv2.so ./Urho3DPlayer 
Thanks again @Paeryn for your reply. I do really appreciate your support. I hope we find a solution soon.

The following are the output of ldd command:

Code: Select all

[email protected]:~/Urho3D/build/bin $ ldd Urho3DPlayer
        linux-vdso.so.1 (0x7efab000)
        /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f23000)
        libbcm_host.so => /opt/vc/lib/libbcm_host.so (0x76efd000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76ed5000)
        librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x76ebe000)
        libGLESv2.so => /opt/vc/lib/libGLESv2.so (0x76e99000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76e1e000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76d42000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76d15000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76ced000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76bac000)
        libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0x76b96000)
        libvcos.so => /opt/vc/lib/libvcos.so (0x76b7c000)
        /lib/ld-linux-armhf.so.3 (0x54ba1000)
        libEGL.so => /opt/vc/lib/libEGL.so (0x76b42000)
Running the following command also gives the same error.

Code: Select all

LD_PRELOAD=/opt/vc/lib/libEGL.so:/opt/vc/lib/libGLESv2.so ./Urho3DPlayer 
So, what is wrong with my system !?

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 1:19 pm

I found this in the github codes of Urho3D :

In Urho3D/Source/ThirdParty/SDL/src/video/SDL_egl.c
(https://github.com/urho3d/Urho3D/blob/9 ... /SDL_egl.c)

Code: Select all

    if (egl_dll_handle == NULL) {
        return SDL_SetError("Could not initialize OpenGL / GLES library");
}
Also found a comment in the same code:

Code: Select all

/* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */
So, what would be the solution !!?

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 1:42 pm

This is the output of glxinfo:

Code: Select all

name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
...
But runing glxgears works perfectly. (Although it needs experimental OpenGL to be enabled for better performance! But it works!!)

Isn't this strange that is shpws 0 screens !?

User avatar
Paeryn
Posts: 2229
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Fatal Error: GLES2/gl2.h: No such file or directory

Sat Oct 15, 2016 2:15 pm

OMID-313 wrote:This is the output of glxinfo:

Code: Select all

name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
...
But runing glxgears works perfectly. (Although it needs experimental OpenGL to be enabled for better performance! But it works!!)

Isn't this strange that is shpws 0 screens !?
Glxgears needs the experimental OpenGL because it doesn't use the native OpenGLES. Without the experimental OpenGL driver you will probably get software rendering which would be slow (low single figure fps more than likely).

I think you are confused by the screen numbering. Display 0 Screen 0 is the first screen on the first display (numbering start at 0 not 1).

My only thought is that if you have the mesa drivers installed (which you seem to) then Urho3D may still be trying to load them instead of the native ones (even though the dynamic linker is saying otherwise).
She who travels light — forgot something.

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: ERROR: Could not initialize OpenGL / GLES library

Sun Oct 16, 2016 11:06 am

Ok, the problem is finally solved !!

I found a similar thread here:
http://raspberrypi.stackexchange.com/qu ... 2-0-window
So I removed the mesa dev by:

Code: Select all

sudo apt-get remove mesa-common-dev
And reinstalled Urho3D.
Now the problem is solved.
The example games run OK.

But there's one more problem:
When running example games, the control keys (like WASD, arrows, space-bar, etc.) don't work at all.
How can I enable them !?

User avatar
OMID-313
Posts: 141
Joined: Tue Jan 20, 2015 4:45 pm

Re: ERROR: Could not initialize OpenGL / GLES library

Mon Oct 17, 2016 9:49 am

Any suggestions?
Why doesn't keyboard keys or even mouse clicks work inside games !?

User avatar
topguy
Posts: 5018
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: ERROR: Could not initialize OpenGL / GLES library

Mon Oct 17, 2016 10:08 am

The question very quickly becomes, how does Urho3D read keyboard and mouse ?

Any logging related to "/dev/input" ?

Return to “OpenGLES”