# Cinder EGL Linux Problem

**URL:** <https://discourse.libcinder.org/t/cinder-egl-linux-problem/988>\
**Category:** Using Cinder\
**Created:** [December 11, 2017, 10:51am UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988 "2017-12-11T10:51:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thyrrestrup](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@thyrrestrup](https://discourse.libcinder.org/u/thyrrestrup)\
**Post date:** [December 11, 2017, 10:51am UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/1 "2017-12-11T10:51:00Z")

</div>

Hi

I need EGL for a project on linux and tried to compile cinder with es3 support.  
After adding the `if ! defined` around the debug parameters in `RendererGlLinuxGlfw.cpp` as seen below - I was able to compile Cinder with the following `cmake .. -DCINDER_TARGET_GL=es3`

```auto
#if ! defined( CINDER_GL_ES )
	platformData->mDebug = mRenderer->getOptions().getDebug();
	platformData->mDebugLogSeverity = mRenderer->getOptions().getDebugLogSeverity();
	platformData->mDebugBreakSeverity = mRenderer->getOptions().getDebugBreakSeverity();
	platformData->mObjectTracking = mRenderer->getOptions().getObjectTracking();
#endif

```

But when I try to compile the BasicApp example with `cmake .. -DCINDER_TARGET_GL=es3` - I get the following errors about GLX not being defined:

```auto
/usr/bin/cmake -E cmake_link_script CMakeFiles/BasicApp.dir/link.txt --verbose=1
/usr/bin/c++ -g CMakeFiles/BasicApp.dir/home/debian/Cinder/samples/BasicApp/src/BasicApp.cpp.o -o Debug/BasicApp/BasicApp -L/usr/lib/gcc/x86_64-linux-gnu/6 -rdynamic /home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a -lX11 -lXext -lXcursor -lXinerama -lXrandr -lXi -lEGL -lGLESv2 -lz -lcurl -lfontconfig -lpulse -lmpg123 -lsndfile -lgobject-2.0 -lglib-2.0 -lgstreamer-1.0 -lgstbase-1.0 -lgstapp-1.0 -lgstvideo-1.0 -lgstgl-1.0 /home/debian/Cinder/lib/linux/x86_64//libboost_system.a /home/debian/Cinder/lib/linux/x86_64//libboost_filesystem.a -ldl -lpthread 
/home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a(x11_init.c.o): In function `_glfwPlatformTerminate':
/home/debian/Cinder/src/glfw/src/x11_init.c:808: undefined reference to `_glfwTerminateGLX'
/home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a(x11_window.c.o): In function `_glfwPlatformCreateWindow':
/home/debian/Cinder/src/glfw/src/x11_window.c:1555: undefined reference to `_glfwInitGLX'
/home/debian/Cinder/src/glfw/src/x11_window.c:1557: undefined reference to `_glfwChooseVisualGLX'
/home/debian/Cinder/src/glfw/src/x11_window.c:1576: undefined reference to `_glfwCreateContextGLX'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/BasicApp.dir/build.make:115: recipe for target 'Debug/BasicApp/BasicApp' failed
make[2]: *** [Debug/BasicApp/BasicApp] Error 1
make[2]: Leaving directory '/home/debian/Cinder/samples/BasicApp/proj/cmake/build'
CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/BasicApp.dir/all' failed
make[1]: *** [CMakeFiles/BasicApp.dir/all] Error 2
make[1]: Leaving directory '/home/debian/Cinder/samples/BasicApp/proj/cmake/build'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2

```

I did however manage to get a clean GLFW example running with a EGL window.

Any pointers are welcome.

---

<div class="post-metadata">

**Author:** ![petros](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/petros/32/26_2.png) [@petros](https://discourse.libcinder.org/u/petros)\
**Post date:** [December 11, 2017, 2:21pm UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/2 "2017-12-11T14:21:09Z")

</div>

Hi Tobias,

can you try rebuilding Cinder after adding the following [here](https://github.com/cinder/Cinder/blob/master/proj/cmake/platform_linux.cmake#L13) :

```auto
${CINDER_SRC_DIR}/glfw/src/glx_context.c

```

It seems like it has been missed in the case of GLES.

Cheers,  
Petros

---

<div class="post-metadata">

**Author:** ![thyrrestrup](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@thyrrestrup](https://discourse.libcinder.org/u/thyrrestrup)\
**Post date:** [December 11, 2017, 3:30pm UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/3 "2017-12-11T15:30:53Z")

</div>

Hi Petros

Yep that did the trick - I also had to add a glfwWindowHint to enable EGL - I’m preparing a pull request for the changes I had to make… Also some of the glfw macros used are deprecated…

Thanks!

---

<div class="post-metadata">

**Author:** ![Callum](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@Callum](https://discourse.libcinder.org/u/Callum)\
**Post date:** [December 12, 2017, 1:03am UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/4 "2017-12-12T01:03:32Z")

</div>

Hi all,

I’m on Odroid XU4, Ubuntu 16.04.3, trying to get `-DCINDER_TARGET_GL=es3` working too.  
I tried out the above, but no success. I didn’t figure out what to do with `glfwWindowHint` though, so maybe I’ll keenly await that pull request.

Runtime error is:

```auto
Rendering with OpenGL ES 3.0
(glfw:error): error=65542, desc=GLX: GLX extension not found
gl_es_load entered...
gl_es_2_0_ext_load: SUCCESSFUL! | 91 procs loaded
gl_es_3_0_load: SUCCESSFUL! | 104 procs loaded
gl_es_load: SUCCESSFUL
getStockShader error: VERTEX:
 1: #version 300 es
 2: uniform mat4 ciModelViewProjection;
 3: in vec4 ciPosition;
 4: in vec4 ciColor;
 5: out lowp vec4 Color;
 6: void main( void )
 7: {
 8: gl_Position = ciModelViewProjection * ciPosition;
 9: Color = ciColor;
10: }
11:

[1] 13414 segmentation fault Debug/PROJECT/PROJECT

```

The default OGL does work, but performs poorly and maxes out the 8 cpu cores on a basic simple app.

---

<div class="post-metadata">

**Author:** ![thyrrestrup](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@thyrrestrup](https://discourse.libcinder.org/u/thyrrestrup)\
**Post date:** [December 12, 2017, 9:29am UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/5 "2017-12-12T09:29:57Z")

</div>

I’ve created a pull request for fixing this.  
[https://github.com/cinder/Cinder/pull/1943](https://github.com/cinder/Cinder/pull/1943)

---

<div class="post-metadata">

**Author:** ![Callum](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@Callum](https://discourse.libcinder.org/u/Callum)\
**Post date:** [December 14, 2017, 2:07am UTC](https://discourse.libcinder.org/t/cinder-egl-linux-problem/988/6 "2017-12-14T02:07:02Z")

</div>

That works great, thanks!
