Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Failed to load driver: swrast ?
Qt 6.12 LTS is out! See what's new in the release blog

Failed to load driver: swrast ?

Scheduled Pinned Locked Moved General and Desktop
27 Posts 6 Posters 63.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #16

    in the QtCreator "Welcome" Tab - > Examples i can choose in the rightmost top corner between 4.8 and 5.2.
    I selected qt5 example but i think the creator environment setting is wrong. In qt4 i think i used #include <QtGui>.

    When i change #include <QtWidgets> to <QtGui> in a qt5 example i got no error message.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #17

      [quote author="wally123" date="1398324670"]
      here the QT… part of “env” :

      @QEMU_AUDIO_DRV=pa
      QT_IM_MODULE=xim
      QT_IM_SWITCHER=imsw-multi
      QT_PLUGIN_PATH=/home/op/.kde4/lib/kde4/plugins/:/usr/lib/kde4/plugins/
      QT_SYSTEM_DIR=/usr/share/desktop-data
      SDL_AUDIODRIVER=pulse@
      

      What’s the relevant lines, what to compare ?
      [/quote]

      I don't exactly know what environment variables to compare. I hoped the difference would be obvious when you see it.

      Try to change "Build Environment" to "Clean Environment" in "Run Environment" section of the Project settings.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #18

        [quote author="wally123" date="1398330041"]maybe another hint to get behind what i setup wrong:

        When i open examples from Qt 5.2.1 i get :
        @.../Examples/basicdrawing/window.cpp:44: error: QtWidgets: No such file or directory
        #include <QtWidgets>
        ^@
        on every single example i tested so far.
        [/quote]

        I think SGaist is right and you open a Qt4 example.
        In Qt5 basicdrawing is located in
        @
        .../examples/widgets/painting/basicdrawing
        @

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #19

          With "Clean environment" build is ok but run :
          @QXcbConnection: Could not connect to display @

          When i set to "System Environment" the recently built examples runs without error messages.
          No more libGL message.
          I'm confused

          I think i should delete all configuration files of QtCreator
          and restart creator to set all new.
          I s this possible ?
          Which files to delete ?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andreyc
            wrote on last edited by
            #20

            [quote author="wally123" date="1398369609"]With "Clean environment" build is ok but run :
            @QXcbConnection: Could not connect to display @
            [/quote]
            It is ok because there is no any X11 settings

            [quote author="wally123" date="1398369609"]
            When i set to "System Environment" the recently built examples runs without error messages.
            No more libGL message.
            [/quote]
            It confirms the fact that when you run the application from a terminal you don't have this message. So there is something wrong in Build Environment settings. You can compare the settings line by line if you would like.

            [quote author="wally123" date="1398369609"]
            I think i should delete all configuration files of QtCreator
            and restart creator to set all new.
            I s this possible ?
            Which files to delete ?
            [/quote]

            Build environment is a per project settings.
            I think that you can delete .pro.user file and then open this project again you will have a build environment that is consistent with a system environment.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #21

              Can not get rid of the libGL error, anyway.
              I removed qt4.8 kit and lib from Build&Run settings to make things more clear and focus to qt5 only.
              Tried several modifications in Build- and Run-environment.
              I have no idea what to search for and what causes the error message.
              i 'm totally confused now.
              Any idea what remains to do highly welcome.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #22

                creating a new qt5 project generates the following .pro file:
                @QT += core gui

                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                TARGET = test_1
                TEMPLATE = app

                SOURCES += main.cpp
                mainwindow.cpp

                HEADERS += mainwindow.h

                FORMS += mainwindow.ui
                @

                is this as should be ?
                Whats about "QT_MAJOR_VERSION, 4" ?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #23

                  @
                  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                  @
                  Yes it is as it should be.
                  QT_MAJOR_VERSION four and before are all-in-one library. Containers, network, widgets, etc all in one library.
                  Starting from Qt5 all components are independent and if you need to use the widgets you need to specify it.

                  bq. Can not get rid of the libGL error, anyway.

                  You said that with "System Environment" you don't have that message.
                  Did you try to close a project, remove .pro.user file and open project again?

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #24

                    bq. You said that with “System Environment” you don’t have that message.

                    Yes, but i can not reproduce this anymore. In the meanwhile i did
                    several de- and reinstallations, also tried the NVIDIA driver installer
                    from the nvidia homepage. Maybe the following output of the
                    nvidia install contains a hint to a solution:
                    @ERROR: Kernel configuration is invalid."
                    include/generated/autoconf.h or include/config/auto.conf are missing.";
                    Run 'make oldconfig && make prepare' on kernel src to fix it.";
                    @

                    as root in /usr/src/linux:

                    @tiro:/usr/src/linux # make cloneconfig
                    HOSTCC scripts/basic/fixdep
                    HOSTCC scripts/kconfig/conf.o
                    SHIPPED scripts/kconfig/zconf.tab.c
                    SHIPPED scripts/kconfig/zconf.lex.c
                    SHIPPED scripts/kconfig/zconf.hash.c
                    HOSTCC scripts/kconfig/zconf.tab.o
                    HOSTLD scripts/kconfig/conf
                    Cloning configuration file /proc/config.gz

                    configuration written to .config

                    tiro:/usr/src/linux # make prepare
                    scripts/kconfig/conf --silentoldconfig Kconfig
                    make[1]: *** No rule to make target /usr/src/linux-3.11.10-7/arch/x86/syscalls/syscall_32.tbl', needed by arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h'. Stop.
                    make: *** [archheaders] Error 2
                    @

                    i even do not know, building the nvidia driver makes any sense.

                    bq. Did you try to close a project, remove .pro.user file and open project again?

                    Yes, i did several tests on this, but libGL error persists.

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #25

                      Seems the NVidia driver is not relevant to solve this problem.

                      I installed @qt-opensource-linux-x86-5.2.1.run@

                      from http://qt-project.org/downloads

                      No annoying message anymore :)

                      Now searching for differences. Most probably is difference in environment settings i assume (?)
                      ... i hope

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #26

                        I have the same consoleWorks-QtCreatorDoesn't issue here. But going to system environment doesn't fix anything.

                        The issue is much more difficult for me since I use QtQuick 2 and thus an OpenGL shader which plainly fails to compile. It's the default "hello, world !" example and I cannot see the "hello, world !".

                        Here is what it tells :
                        @QML debugging is enabled. Only use this in a safe environment.
                        libGL error: failed to load driver: swrast
                        QOpenGLShaderProgram: could not create shader program
                        QOpenGLShader: could not create shader
                        QOpenGLShader: could not create shader
                        shader compilation failed:
                        ""
                        QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( textureScale ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( color ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( alphaMin ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( alphaMax ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( fontScale ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( vecDelta ): shader program is not linked
                        QOpenGLShaderProgram: could not create shader program
                        QOpenGLShader: could not create shader
                        QOpenGLShader: could not create shader
                        shader compilation failed:
                        ""
                        QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( textureScale ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( color ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( alphaMin ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( alphaMax ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( fontScale ): shader program is not linked
                        QOpenGLShaderProgram::uniformLocation( vecDelta ): shader program is not linked@

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #27

                          For anybody running into this: unset the LD_LIBRARY_PATH in Projects - Run - Run Environment

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt
                          • Unsolved