Xlib: extension "GLX" missing on display ":0"

Hi!

I am trying to run OGRE3D graphics engine (www.ogre3d.org, source code can be found in www.github.com/OGRECave/ogre) in an Apalis iMX8QM. I managed to compile it inside a docker container, whose Dockerfile is the following:

FROM --platform=linux/arm64 torizon/wayland-base-vivante:2 AS base
RUN apt-get -y update && apt-get install -y --no-install-recommends \
    apt-utils \
    && apt-mark hold dash && apt-get -y upgrade && apt-mark unhold dash \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
ARG ACCEPT_FSL_EULA=1
RUN apt-get -y update && apt-get install -y --no-install-recommends \
    libwayland-client0 \
    libwayland-server0 \
    libgal-vivante1 \
    libvsc-vivante1 \
    libgbm-vivante1 \
    libegl-vivante1 \
    libgl-vivante1 \
    libglesv2-vivante1 \
    libglesv1-cm-vivante1 \
    libglslc-vivante1 \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
# Make sure the user can access DRM and video devices
RUN usermod -a -G video,render torizon
RUN apt-get -y update && apt-get install -y git cmake gcc g++ make libxrandr-dev libglu1-mesa-dev libzip-dev libfreeimage-dev libpoco-dev libois-dev libzzip-0-13 libzzip-dev doxygen libcgal>
USER torizon
RUN cd /home/torizon/ && git clone https://github.com/OGRECave/ogre
USER root
RUN apt-get install -y libsdl2-2.0
USER torizon
 RUN mkdir -p /home/torizon/ogre/bld && cd /home/torizon/ogre/bld && cmake -DCMAKE_BUILD_TYPE=Debug -DOGRE_BUILD_RENDERSYSTEM_GLES2=1 -DOGRE_BUILD_SAMPLES=1 -DOGRE_CONFIG_THREADS=0 -DOGRE_INS
TALL_DOCS=0 -DOGRE_BUILD_PLUGIN_CG=0 -DOGRE_INSTALL_MEDIA=1 -DOGRE_BUILD_TOOLS=0 -DOGRE_BUILD_TESTS=0 -DOGRE_INSTALL_SAMPLES=1 ../

RUN cd /home/torizon/ogre/bld && make -j4
USER root
RUN cd /home/torizon/ogre/bld && make install

Here I try to run SampleBrowser, a sample application that gets compiled when you compile the graphics engine. I ran it through gdb to see the backtrace and show where it crashes. Also you can see the error message:

Xlib: extension “GLX” missing on display “:0.0”.

torizon@7f7ab3404e09:~/ogre/bld/bin$ gdb SampleBrowser
GNU gdb (Debian 9.2-1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from SampleBrowser...
(gdb) catch throw
Catchpoint 1 (throw)
(gdb) r
Starting program: /home/torizon/ogre/bld/bin/SampleBrowser
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Creating resource group General
Creating resource group OgreInternal
Creating resource group OgreAutodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
ETC codec registering
ASTC codec registering
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library /home/torizon/ogre/bld/lib/RenderSystem_GLES2.so.1.12.12
Installing plugin: OpenGL ES 2.0 RenderSystem
OpenGL ES 2.x Rendering Subsystem created.
Xlib:  extension "GLX" missing on display ":0.0".

Program received signal SIGSEGV, Segmentation fault.
0x0000fffff6b5aad8 in glXGetFBConfigs () from /usr/lib/aarch64-linux-gnu/libGL.so.1.2
(gdb) bt
#0  0x0000fffff6b5aad8 in glXGetFBConfigs () from /usr/lib/aarch64-linux-gnu/libGL.so.1.2
#1  0x0000fffff6b5ce84 in glXChooseFBConfigSGIX () from /usr/lib/aarch64-linux-gnu/libGL.so.1.2
#2  0x0000fffff6c62490 in Ogre::GLXGLSupport::chooseFBConfig (this=0xaaaaaab165c0, attribList=0x0, nElements=0xffffffffe8c0)
    at /home/torizon/ogre/RenderSystems/GLSupport/src/GLX/OgreGLXGLSupport.cpp:522
#3  0x0000fffff6c61574 in Ogre::GLXGLSupport::GLXGLSupport (this=0xaaaaaab165c0, profile=4) at /home/torizon/ogre/RenderSystems/GLSupport/src/GLX/OgreGLXGLSupport.cpp:135
#4  0x0000fffff6c61208 in Ogre::getGLSupport (profile=4) at /home/torizon/ogre/RenderSystems/GLSupport/src/GLX/OgreGLXGLSupport.cpp:64
#5  0x0000fffff6c3e7c0 in Ogre::GLES2RenderSystem::GLES2RenderSystem (this=0xaaaaaab15bb0) at /home/torizon/ogre/RenderSystems/GLES2/src/OgreGLES2RenderSystem.cpp:178
#6  0x0000fffff6c3e114 in Ogre::GLES2Plugin::install (this=0xaaaaaab15b30) at /home/torizon/ogre/RenderSystems/GLES2/src/OgreGLES2Plugin.cpp:48
#7  0x0000fffff79c026c in Ogre::Root::installPlugin (this=0xaaaaaab00b20, plugin=0xaaaaaab15b30) at /home/torizon/ogre/OgreMain/src/OgreRoot.cpp:1188
#8  0x0000fffff6c2b1c4 in Ogre::dllStartPlugin () at /home/torizon/ogre/RenderSystems/GLES2/src/OgreGLES2EngineDll.cpp:41
#9  0x0000fffff79c064c in Ogre::Root::loadPlugin (this=0xaaaaaab00b20, pluginName="/home/torizon/ogre/bld/lib/RenderSystem_GLES2") at /home/torizon/ogre/OgreMain/src/OgreRoot.cpp:1237
#10 0x0000fffff79bf2c4 in Ogre::Root::loadPlugins (this=0xaaaaaab00b20, pluginsfile="./plugins.cfg") at /home/torizon/ogre/OgreMain/src/OgreRoot.cpp:973
#11 0x0000fffff79bc9ac in Ogre::Root::Root (this=0xaaaaaab00b20, pluginFileName="./plugins.cfg", configFileName="./ogre.cfg", logFileName="./ogre.log")
    at /home/torizon/ogre/OgreMain/src/OgreRoot.cpp:227
#12 0x0000fffff7f76d9c in OgreBites::ApplicationContextBase::createRoot (this=0xfffffffff238) at /home/torizon/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:191
#13 0x0000fffff7f7669c in OgreBites::ApplicationContextBase::initApp (this=0xfffffffff238) at /home/torizon/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:55
#14 0x0000aaaaaaab6b28 in OgreBites::SampleContext::go (this=0xfffffffff238, initialSample=0x0) at /home/torizon/ogre/Samples/Common/include/SampleContext.h:143
#15 0x0000aaaaaaab44e4 in main (argc=1, argv=0xfffffffff648) at /home/torizon/ogre/Samples/Browser/src/main.cpp:89

I run the container with the following command:

docker run -e ACCEPT_FSL_EULA=1 -e X11_UNIX_SOCKET=/tmp/.X11-unix -e WAYLAND_DISPLAY=wayland-0 -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e DISPLAY=:0 -it --rm --name=wayland-app --user=torizon -v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore -v /tmp:/tmp -v /run/:/run/ --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' --cap-add=SYS_PTRACE --security-opt seccomp=unconfined ogre-way-base

Maybe some env variables aren’t needed, but I added them trying to make it run.
If useful, this is env command output inside the container:

torizon@a5e5021d45e9:/$ env
HOSTNAME=a5e5021d45e9
PWD=/
HOME=/home/torizon
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
WAYLAND_DISPLAY=wayland-0
TERM=xterm
DISPLAY=:0
SHLVL=1
XDG_RUNTIME_DIR=/run/user/1000
LC_ALL=C.UTF-8
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
WAYLAND_USER=torizon
X11_UNIX_SOCKET=/tmp/.X11-unix
ACCEPT_FSL_EULA=1
_=/usr/bin/env

I tried running x11 applications, like xeyes or xclock and they run fine.

I would like to know if there is any problem with my configuration, or if there’s something like GLX that isn’t supported, or what I should do in order to solve this. I am asking that here because I think the problem isn’t related to Ogre, as I saw in the backtrace where the application crashes.

Thank you in advance

Greetings @tomas.ayi,

Hmm I don’t believe there is an issue with GLX, or at least not a known issue.

What happens if you try to run other GLX-based utilities? Like glxgears for example. Also is there any useful info if you try to run glxinfo?

Best Regards,
Jeremias

Hi Jeremias, thank you for your fast reply.

This is the output from glxgears:

torizon@e374aeebd4f9:/$ glxgears
Xlib:  extension "GLX" missing on display ":0".
Error: couldn't get an RGB, Double-buffered visual

I forgot to mention that I tried DISPLAY=:0, DISPLAY=:0.0, DISPLAY=:0.1, DISPLAY=:1.0, DISPLAY=:1.1 and DISPLAY=:1, all with glxgears and with Ogre’s SampleBrowser, with the same results.

The output from glxinfo is:

torizon@e374aeebd4f9:/$ glxinfo
name of display: :0
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Segmentation fault

With a DISPLAY different from :0 or :0.0, the error is:

torizon@e374aeebd4f9:/$ glxinfo
Error: unable to open display :0.1

I did some further research and ran this across with the team internally. Unfortunately this might not be as simple as it seems.

To summarize, OpenGL with GLX is tied to X11. X11 isn’t something that the i.MX8 graphic drivers support. Not to say that it isn’t impossible but you’d require some additional logic or in-between software that uses opengles which should work with i.MX8 graphics. Either way that is to say this won’t work out of the box as is.

As for your end goal of running OGRE 3D, it seems there may be some possibilities. Upon quick look it seems in the specs of OGRE V1.X there is support for opengles2. (not sure how well versions of everything involved match up though). I’m not familiar with OGRE but there seems to be a way to perhaps configure/build it differently.

Best Regards,
Jeremias

Dear Jeremias,

Is there any update on the support of GLX on iMX8 ?

This thread from April 2018 says it is not supported on iMX8 but on iMX6 and iMX7

Could you updated on this ?

Best regards,
Fabian

Hi @fdortu,

As far as I’m aware this has not changed. NXP still does not provide X11 support for their i.MX8* SoCs and I don’t believe they plan to honestly.

Your only hope in this case would be future open-source graphics drivers for the i.MX8 that has such support.

Best Regards,
Jeremias