Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Issues Building Static Qt

Issues Building Static Qt

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
19 Posts 4 Posters 5.7k Views 3 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      3
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        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?

        mrjjM 1 Reply Last reply
        0
        • mzimmersM mzimmers

          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?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by mzimmers
            #5

            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?

            mrjjM 1 Reply Last reply
            0
            • mzimmersM mzimmers

              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?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #7

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

                mzimmersM 1 Reply Last reply
                0
                • mzimmersM mzimmers

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

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #8

                  BTT.

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

                  jsulmJ 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    BTT.

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

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @mzimmers Take a look at https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    mzimmersM 1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @mzimmers Take a look at https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #10

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

                      mzimmersM 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

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

                        mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #11

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

                        kshegunovK 1 Reply Last reply
                        0
                        • mzimmersM mzimmers

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

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by kshegunov
                          #12

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

                          Read and abide by the Qt Code of Conduct

                          mzimmersM 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

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

                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #13

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

                            1 Reply Last reply
                            0
                            • mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by
                              #14

                              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.

                              kshegunovK 1 Reply Last reply
                              0
                              • mzimmersM mzimmers

                                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.

                                kshegunovK Offline
                                kshegunovK Offline
                                kshegunov
                                Moderators
                                wrote on last edited by
                                #15

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

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                2
                                • mzimmersM Offline
                                  mzimmersM Offline
                                  mzimmers
                                  wrote on last edited by
                                  #16

                                  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?

                                  kshegunovK 1 Reply Last reply
                                  0
                                  • mzimmersM mzimmers

                                    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?

                                    kshegunovK Offline
                                    kshegunovK Offline
                                    kshegunov
                                    Moderators
                                    wrote on last edited by
                                    #17

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

                                    Read and abide by the Qt Code of Conduct

                                    1 Reply Last reply
                                    0
                                    • mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by
                                      #18

                                      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.

                                      1 Reply Last reply
                                      0
                                      • mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on last edited by
                                        #19

                                        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.

                                        1 Reply Last reply
                                        5

                                        • Login

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