Important: Please read the Qt Code of Conduct -

Qt Static build Rendering looks bad and unable to read shaders

  • I recently did a Qt 5.9.1 Static build using the configuration

    configure -c++std c++11 -prefix C:\Qt\install -platform win32-msvc2017 -release -opensource -static -static-runtime -no-compile-examples -opengl desktop -nomake examples -nomake tests

    The build works fine, and I'm able to create standalone executables for simple applications. However, when I try to load a QML application, the resolution looks bad and my mouse does not map with the GUI correctly. It seems that the application thinks the mouse is higher than it actually is. I had this issue before with my dynamic kits, but I solved it with the following:


    Unfortunately it does work when I try my static build. When I run this program on my other computer with a dedicated GPU, it looks much better, but I still have another error listed below.

    I also receive many errors like these in my program

    ShaderEffect: Failed to read :/QtQuick/Controls/Shaders/blur.vert
    QQuickOpenGLShaderEffect: 'source' does not have a matching property!

    The program uses a slider and the knobs on it are black boxes.


    The program looks and works fine when I switch to my dynamic kit (I have MSVC2017 64 bit and MinGW 32 bit that both work, also 5.9.1).

    Even weirder is that it seems to be QtQuick.Controls 1 that has the issue. When I switch to QtQuick.Controls 2 (e.g., 2.2), a different slider appears but the black boxes disappear.

    How do I fix these issues? Any clue as to what is happening?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You are build Qt with only the desktop OpenGL backend and then you are forcing the software render when running your application. Looks a bit contradictory.

  • @SGaist

    That is a good point. I use the software render when I use the dynamic kits. Removing that line doesn't make a difference for the static build, unfortunately.

    I've tried using QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL); and many of the other attributes before QGuiApplication is created with no success. I think the issue may be with my configuration options when I build. I've been looking online and seeing that maybe I can try using -opengl dynamic when I configure the static build. I'm going to try this in the mean time, because no other solutions have worked. Do you know of any other potential solutions?

    As far as the shaders issue, I've managed a temporary fix by copying the shaders from the source and adding them to a QRC with the prefix specified by the error. It seems that my project thinks they are part of a resource rather than looking for them elsewhere. It's a strange fix but it will work for the time being.

Log in to reply