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?

    Thanks...


  • Lifetime Qt Champion

    Hi
    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
    mingw32-make



  • 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

    Hi
    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.

    EDIT:

    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

    @mzimmers
    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?

    Thanks...



  • BTT.

    Can anyone please give me some guidance? I'm in need of static builds.


  • Qt Champions 2018



  • @jsulm thanks. The PS script that page references is a bit out of date, so I made some changes to it, but it doesn't address the OpenGL error I'm getting on the configure step.



  • Anyone have any ideas on this? Should I report this as a bug?


  • Qt Champions 2017

    Does it fail if you ignore the warning? I don't recall doing anything special when building Qt on windows (dynamic, but still).



  • @kshegunov yes it does fail. I get the impression there's some implicit set-up to be done for the Angle stuff, but it's not documented anywhere that I can find.



  • Here's an error message I'm getting during configure:

    C:\Qt\Static\src\qt-everywhere-src-5.12.3> configure -prefix C:\Qt\Static\src\qt-everywhere-src-5.12.3\qt-build -static -static-runtime -opengl desktop -nomake examples -nomake tests
    ...
    Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
    On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
    On macOS, you can use Homebrew's llvm package.
    On Windows, you must set LLVM_INSTALL_DIR to the installation path.
    
    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.
    
    Check config.log for details.
    

    So, I gather that I'm missing something related to OpenGL, but I really don't know what it might be.


  • Qt Champions 2017

    Do you have the opengl dev headers (I think they're in the directx sdk)?



  • I didn't have DirectX installed. Now that I do, though, I don't see anything that looks like what you're talking about. None of the files listed here are in the DirectX directory.

    I'm completely out of my element here -- do I need an Angle installation as well?


  • Qt Champions 2017

    @mzimmers said in Issues Building Static Qt:

    I didn't have DirectX installed. Now that I do, though, I don't see anything that looks like what you're talking about. None of the files listed here are in the DirectX directory.

    Did you by mistake install the redistributables? I was talking specifically about the SDK (software development kit). If I'm not mistaken it [the DX SDK] is also available through the Windows SDK.

    I'm completely out of my element here -- do I need an Angle installation as well?

    Honestly me too a bit. I think you don't, although I'm not completely certain. If I recall correctly Angle is a software implementation to substitute the GL. I hope someone's going to correct me if I'm wrong.



  • No, I installed the SDK -- went into this directory: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010).

    I did open a bug report for this (here) though I'm not sure that the assignee fully understands what's going on. I'm just amazed that more people aren't experiencing something similar.



  • UPDATE:

    I got the configure (and make/make install) to run successfully. On a suggestion from the person handling the bug case I opened, I deleted my existing source base and re-extracted it. I then created a subdirectory for the build, went into that subdirectory and issued this command:

    ..\configure -prefix C:\QtStatic\qt-everywhere-src-5.12.3 -platform win32-g++ -static -static-runtime -opengl desktop -nomake examples -nomake tests -recheck-all
    

    Then ran mingw32-make.

    Both the wiki page on this topic, and the powershell script it references, are flawed. And the build process is a bit fragile: even by creating and using a shadow build, I somehow corrupted my source, causing the OpenGL red herring that was driving me crazy. A fresh extraction was the key, but a couple other points:

    • do use the -platform switch when running configure
    • -static and -static-runtime are both needed
    • when in doubt, use the -recheck-all switch

    Anyway, this hopefully closes out this nasty little chapter. Thanks to all involved; I'll be back eventually with some follow-up questions on creating standalone apps.


Log in to reply