Issues Building Static Qt

  • Hi all -

    Updated Qt, and ran into problems building a static version.

    I tried following the directions here and this is what I got:

    C:\Qt\Static\src\qt-everywhere-src-5.12.3>configure -static -release -no-exceptions
    + cd qtbase
    + C:\Qt\Static\src\qt-everywhere-src-5.12.3\qtbase\configure.bat -top-level -static -release -no-exceptions
    Cannot detect host toolchain. Please use -platform. Aborting.
    C:\Qt\Static\src\qt-everywhere-src-5.12.3>configure -static -release -no-exceptions -platform win32-g++
    + cd qtbase
    + C:\Qt\Static\src\qt-everywhere-src-5.12.3\qtbase\configure.bat -top-level -static -release -no-exceptions -platform win32-g++
    Bootstrapping qmake ...
    'mingw32-make' is not recognized as an internal or external command,
    operable program or batch file.

    I remember running into issues building a static Qt library in the past, but not this particular error. Can someone tell me where I went wrong?


  • Lifetime Qt Champion

    For your second try
    C:\Qt\Static\src\qt-everywhere-src-5.12.3>configure -static -release -no-exceptions -platform win32-g++

    try running
    "C:\Qt\5.12.3\XXXX\bin\qtenv2.bat" FIRST
    Its in your compiler folder. I dont have mingw installed so dont know the excact path.
    It will set up paths etc. as it seems it cannot find

  • Hi mrjj -

    That worked, though I had to remove the "-no-exceptions" command line option.

    Unfortunately, I also got this warning:

    WARNING: Using OpenGL ES 2.0 on Windows without ANGLE.
    The build will most likely fail.
    Specify -opengl desktop to use regular OpenGL.

    This I have seen in the past, but I don't remember what I did about it. Might you be familiar with this issue?

    I went ahead and ran mingw32-make, but got this error:

    g++ -static -static-libgcc -Wl,-s -Wl,-subsystem,console -Wl,--gc-sections -o ..\..\..\bin\moc.exe .obj/release/moc.o .obj/release/preprocessor.o .obj/release/generator.o .obj/release/parser.o .obj/release/token.o .obj/release/main.o  -LC:\Qt\Static\src\qt-everywhere-src-5.12.3\qtbase\lib C:\Qt\Static\src\qt-everywhere-src-5.12.3\qtbase\lib\libQt5Bootstrap.a -luser32 -lole32 -ladvapi32 -lshell32 -lnetapi32 -luuid C:\Qt\Tools\mingw730_64\x86_64-w64-mingw32\lib\libz.a .obj\release\moc_resource_res.o
    .obj\release\moc_resource_res.o: file not recognized: File format not recognized

    Any ideas on this one?

  • Lifetime Qt Champion

    Nope, i only build a static version once a long time ago :)
    Well did you add the -opengl desktop ?

    • file not recognized: File format not recognized

    that's very odd.
    Did you start clean over so nothing was left from the previous run?

  • Yes, I added the -opengl desktop and then got this error:

    ERROR: Feature 'opengl-desktop' was enabled, but the pre-condition '(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
                              || (!config.watchos && !config.win32 && !config.wasm && libs.opengl)' failed.
    ERROR: The OpenGL functionality tests failed!
    You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
    QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

    I have no idea what to do about this.


    No, I didn't run a clean command. Are you referring to a make clean, or to something to undo the configure command?

  • Lifetime Qt Champion

    yes something like clean as to be sure it start fresh over.
    Hmm its odd that !config.win32 failed as you did specify that.

  • I need to return my attention to this issue. The problem at hand is this error when I run configure:

    WARNING: Using OpenGL ES 2.0 on Windows without ANGLE.
    The build will most likely fail.
    Specify -opengl desktop to use regular OpenGL.

    I I have my environment variable ANGLE_DIR set to C:\Qt\Static\src\qt-everywhere-opensource-src-5.12.3\qtbase\src\angle. assume that configure is looking for ANGLE source, correct? Or, do I need to build ANGLE libraries before invoking the configure command?


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.