How to install OpenGL in Yocto tdx-reference-multimedia-image to resolve "No GL implementation is available" error

I’m encountering an issue when running an application on my Yocto-based system, and I’m getting the error message: “Failed to start Flutter renderer: No GL implementation is available.” Additionally, when I check the existence of the ‘gtk±3.0’ package using pkg-config, it shows that the ‘gl’ package is not found in the search path and suggests adding the directory containing ‘gl.pc’ to the PKG_CONFIG_PATH environment variable.

root@apalis-imx8-07013820:/usr/lib/pkgconfig# pkg-config --exists --print-errors 'gtk+-3.0'
Package gl was not found in the pkg-config search path.
Perhaps you should add the directory containing `gl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gl', required by 'epoxy', not found

I have already added the ‘mesa’ package to my local.conf, but it seems that ‘gl.pc’ is not present in the ‘/usr/lib/pkgconfig’ directory. When I open the ‘epoxy.pc’ file, it shows the following content:

prefix=/usr
libdir=${prefix}/lib
includedir=${prefix}/include

epoxy_has_glx=1
epoxy_has_egl=1
epoxy_has_wgl=0

Name: epoxy
Description: GL dispatch library
Version: 1.5.10
Requires.private: x11, egl, gl egl
Libs: -L${libdir} -lepoxy
Libs.private: -ldl
Cflags: -I${includedir}

I would appreciate any guidance on how to properly install OpenGL or resolve the “No GL implementation is available” error in Yocto. Additionally, I’d like to know how to ensure that ‘gl.pc’ is available in the ‘/usr/lib/pkgconfig’ directory. Thank you for your help!

Hi @hareendran-tl,

Thanks for posting to Toradex Community!

Regarding your query with a quick search we found below similar post talking about same issue, can you please check if this help

Please feel free to write us back if above do not help with your issue.

Best Regards
Ritesh Kumar

Hi @ritesh.tx ,

I added libgl-mesa-dev package to the yocto and the gl.pc file created under the pkgconfig directory and the error when running the pkg-config --exists --print-errors 'gtk+-3.0' command was gone.

But the following error when running the application still persist.
WARNING **: 06:27:15.221: Failed to start Flutter renderer: No GL implementation is available

Hi @hareendran-tl,

From the log it seems like Flutter not able to use GPU. I will encourage you to check with one of our service partner who will be having expert knowledge of using Flutter with Embedded Linux

Additionally you can also test using below flag, I am not sure if this is right way to do it but for testing please check

export LIBGL_ALWAYS_SOFTWARE=1

Best Regards
Ritesh Kumar