[Webkit-unassigned] [Bug 236592] New: [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 14 07:47:20 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=236592

            Bug ID: 236592
           Summary: [CMake] Cannot find OpenGL when system provides
                    opengl.pc instead of gl.pc
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: aperez at igalia.com

In some systems the OpenGL library cannot be found if the pkg-config module
is called “opengl” (and henceforth values picked from “opengl.pc”) instead
of plainly “gl” (with values from “gl.pc”).

One such case are systems where libglvnd (https://github.com/NVIDIA/libglvnd)
is used as main GL library, letting it dispatch to the most suitable OpenGL
implementation at runtime depending on the system state. In this case the
main library would be libOpenGL.so.0 instead of libGL.so.1 and/or libGLX.so.0;
then libOpenGL.so.0 will handle dispatching lib(EGL|GLX)_<vendor>.so.<N> (for
example libEGL_mesa.so.0 for non-X11 operation with free software Mesa drivers,
or libGLX_nvidia.so.0 when running under X with the proprietary Nvidia driver).

Some notes:

 - If opengl.pc is found, the library name will be libOpenGL.so.0, and it
   will *not* contain GLX symbols. In that case we need to search for glx.pc
   as well, which may include additional flags/libraries that one needs to
   link in order to get the GLX symbols.

 - If gl.pc is found, it can either be provided by libglvnd or not; and in
   both cases linking to the library specified in the pkg-config module *will*
   result in being able to find the GLX symbols.

Therefore:

 - If opengl.pc is *not* found (no libglvnd), we want to keep our existing
   logic: try gl.pc first, fall back to checking the “gl” and “GL” library
   names, and try to figure out whether GLX headers can be found.

 - If opengl.pc is found (libglvnd present), we should prefer that as
   the GL library to link against, and we need to check for the existence of
   glx.pc to determine whether GLX_FOUND should be set.

 - If opengl.pc is found but glx.pc is *not* found we might want to fallback
   to the checking for the gl.pc and the GLX headers as stated above.

Thanks for Haelwenn “lanodan” Monnier who pointed out on IRC that Gentoo has
been carrying a patch to change the checked pkg-config module and library
names to use libglvnd, which allows them to successfully build WebKitGTK :]

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220214/04be6ca0/attachment-0001.htm>


More information about the webkit-unassigned mailing list