Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114431

FindEGL.cmake fails for static linking with Qt

    XMLWordPrintable

Details

    • Linux/X11
    • 14b01b0aa (dev), be8f2e431 (tqtc/lts-6.2), f5bad3787 (6.6), 6d9cbdf33 (6.5)

    Description

      Problem is first seen with 6.4.0 (but was likely there before). with 6.5.1 it is still there.

      Building static Qt was not a problem, but the cmake configuration of my own application failed, however. The error messages indicated that the opengl library EGL could not be found. Because of this, linking to the Qt components I used (Gui, Widgets, ...) failed, with the error message telling that the test HAVE_EGL failed.

      It turned out the culprit was in the file FindEGL.cmake, which comes with the Qt distribution (../lib/cmake/Qt6/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake). In this file, there is the snippet:

       check_cxx_source_compiles("
      #include <EGL/egl.h>
      int main(int, char **) {
           EGLint x= 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
        eglDestroyContext(dpy, ctx);
      }" HAVE_EGL)
      

      The variable EGLint x=0; is not used elsewhere in this code snippet, triggering a warning from the compiler. The warning was treated as an error and the test failed accordingly. A resolution is to add the attribute [[maybe_unused]] immediately following x:

       check_cxx_source_compiles("
      #include <EGL/egl.h>
      int main(int, char **) {    
         EGLint x [[maybe_unused]]=0; EGLDisplay dpy = 0; EGLContext ctx = 0;    
      eglDestroyContext(dpy, ctx);
      }" HAVE_EGL)
      

      With this, the cmake-configuration of my application could again proceed as intended, after which compilation and linking to static Qt was possible.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              bwvb Bw vB
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are 4 open Gerrit changes