Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. *still* having problems building Qt (static)
Forum Update on Monday, May 27th 2025

*still* having problems building Qt (static)

Scheduled Pinned Locked Moved Solved Installation and Deployment
22 Posts 4 Posters 1.9k Views
  • 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 -

    This seems like a problem that just keeps coming up...this time I'm trying to build Qt 5.14.2 (static).

    Here are the steps I followed:

    1. $ git clone https://code.qt.io/qt/qt5.git
    2. $ cd qt5
    3. $ git checkout v5.14.2 // or whatever
    4. $ git submodule update --init --recursive
    5. $ configure -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all -prefix c:\qt5\5.14.2\static

    and here's the configure error:

    In file included from C:/qt/qt5/qtbase/qmake/generators/makefiledeps.cpp:36:0:
    C:/qt/qt5/qtbase/mkspecs/win32-g++/qplatformdefs.h:55:10: fatal error: direct.h: No such file or directory
     #include <direct.h>
              ^~~~~~~~~~
    compilation terminated.
    

    Any ideas what's going on now? Thanks...

    jsulmJ 1 Reply Last reply
    0
    • mzimmersM mzimmers

      Hi all -

      This seems like a problem that just keeps coming up...this time I'm trying to build Qt 5.14.2 (static).

      Here are the steps I followed:

      1. $ git clone https://code.qt.io/qt/qt5.git
      2. $ cd qt5
      3. $ git checkout v5.14.2 // or whatever
      4. $ git submodule update --init --recursive
      5. $ configure -confirm-license -static -static-runtime -opensource -release -platform win32-g++ -opengl desktop -nomake examples -nomake tests -nomake tools -recheck-all -prefix c:\qt5\5.14.2\static

      and here's the configure error:

      In file included from C:/qt/qt5/qtbase/qmake/generators/makefiledeps.cpp:36:0:
      C:/qt/qt5/qtbase/mkspecs/win32-g++/qplatformdefs.h:55:10: fatal error: direct.h: No such file or directory
       #include <direct.h>
                ^~~~~~~~~~
      compilation terminated.
      

      Any ideas what's going on now? Thanks...

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

      @mzimmers https://en.wikipedia.org/wiki/Direct.h
      On my Windows machine it is located in MinGW installation.
      How did you install MinGW?

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

      mzimmersM 1 Reply Last reply
      0
      • jsulmJ jsulm

        @mzimmers https://en.wikipedia.org/wiki/Direct.h
        On my Windows machine it is located in MinGW installation.
        How did you install MinGW?

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

        @jsulm I didn't install MinGW manually; I selected it during my Qt installation.

        I wonder if the problem has something to do with the state of my Qt directory. I have subfolders "5.14.2" and "Qt5.14.1" but Qt 5.14.2 isn't auto-detected by creator.

        I also notice that when I go to https://code.qt.io/qt/ in a browser, I'm redirected to a cgit folder. Seems like there have been some changes to how Qt is to be installed; I wonder if I should just start over.

        jsulmJ 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @jsulm I didn't install MinGW manually; I selected it during my Qt installation.

          I wonder if the problem has something to do with the state of my Qt directory. I have subfolders "5.14.2" and "Qt5.14.1" but Qt 5.14.2 isn't auto-detected by creator.

          I also notice that when I go to https://code.qt.io/qt/ in a browser, I'm redirected to a cgit folder. Seems like there have been some changes to how Qt is to be installed; I wonder if I should just start over.

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

          @mzimmers said in *still* having problems building Qt (static):

          I didn't install MinGW manually; I selected it during my Qt installation

          Same for me and I have that file and it does not depend on installed Qt versions, it's part of MinGW.

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

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

            How did you install Qt?

            jsulmJ 1 Reply Last reply
            0
            • mzimmersM mzimmers

              How did you install Qt?

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

              @mzimmers Using online installer

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

              mzimmersM 1 Reply Last reply
              0
              • jsulmJ jsulm

                @mzimmers Using online installer

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

                @jsulm is that still available, or did they eliminate it? I can't find it.

                jsulmJ 1 Reply Last reply
                0
                • B Offline
                  B Offline
                  B3lette
                  wrote on last edited by
                  #8

                  Using windows Qt Maintenance Tool, I think the correct way to install MinGw is the following :
                  mingw.png

                  Then you have to add MinGW bin directory to %PATH% during compilation : {Qt_install_dir}/Tools/{MinGW_dir}/bin
                  direct.h is located there.

                  mzimmersM 1 Reply Last reply
                  1
                  • mzimmersM mzimmers

                    @jsulm is that still available, or did they eliminate it? I can't find it.

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

                    @mzimmers It is available: https://www.qt.io/download-thank-you?os=windows&hsLang=en

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

                    mzimmersM 1 Reply Last reply
                    1
                    • B B3lette

                      Using windows Qt Maintenance Tool, I think the correct way to install MinGw is the following :
                      mingw.png

                      Then you have to add MinGW bin directory to %PATH% during compilation : {Qt_install_dir}/Tools/{MinGW_dir}/bin
                      direct.h is located there.

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

                      @B3lette I do have those components installed, and my path includes the bin directory. The file direct.h is in C:\Qt\Tools\mingw730_32\i686-w64-mingw32\include; are you saying that I have to add the include directory to my path as well?

                      Thanks...

                      B 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @mzimmers It is available: https://www.qt.io/download-thank-you?os=windows&hsLang=en

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

                        @jsulm thanks for that link, but I'm still unclear on something -- how did you navigate to that path? What I mean is, what is the URL to get to that page?

                        1 Reply Last reply
                        0
                        • mzimmersM mzimmers

                          @B3lette I do have those components installed, and my path includes the bin directory. The file direct.h is in C:\Qt\Tools\mingw730_32\i686-w64-mingw32\include; are you saying that I have to add the include directory to my path as well?

                          Thanks...

                          B Offline
                          B Offline
                          B3lette
                          wrote on last edited by
                          #12

                          @mzimmers said in *still* having problems building Qt (static):

                          @B3lette I do have those components installed, and my path includes the bin directory. The file direct.h is in C:\Qt\Tools\mingw730_32\i686-w64-mingw32\include; are you saying that I have to add the include directory to my path as well?

                          Thanks...

                          No it should be ok ... So it doesn't seem to come from your minGW installation process.
                          Is "sh.exe" in your path ? See : https://bugreports.qt.io/browse/QTBUG-28845
                          I'm not sure about your c:\ in prefix either, maybe it should be relative to the partition's root, like "-prefix qt5\5.14.2\static"

                          @mzimmers said in *still* having problems building Qt (static):

                          @jsulm thanks for that link, but I'm still unclear on something -- how did you navigate to that path? What I mean is, what is the URL to get to that page?

                          Click on :

                          • "Download. Try. Buy" on the upper right hand corner on any qt page
                          • In the category "Downloads for open source users", click on "Go open source"
                          • Scroll all the way down to the link "Download the Qt Online Installer"
                          mzimmersM 1 Reply Last reply
                          1
                          • B B3lette

                            @mzimmers said in *still* having problems building Qt (static):

                            @B3lette I do have those components installed, and my path includes the bin directory. The file direct.h is in C:\Qt\Tools\mingw730_32\i686-w64-mingw32\include; are you saying that I have to add the include directory to my path as well?

                            Thanks...

                            No it should be ok ... So it doesn't seem to come from your minGW installation process.
                            Is "sh.exe" in your path ? See : https://bugreports.qt.io/browse/QTBUG-28845
                            I'm not sure about your c:\ in prefix either, maybe it should be relative to the partition's root, like "-prefix qt5\5.14.2\static"

                            @mzimmers said in *still* having problems building Qt (static):

                            @jsulm thanks for that link, but I'm still unclear on something -- how did you navigate to that path? What I mean is, what is the URL to get to that page?

                            Click on :

                            • "Download. Try. Buy" on the upper right hand corner on any qt page
                            • In the category "Downloads for open source users", click on "Go open source"
                            • Scroll all the way down to the link "Download the Qt Online Installer"
                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #13

                            @B3lette thanks for the direction to the download page.

                            I do have sh.exe in my path. The procedure I listed above used to work. I decided to re-install Qt from scratch. I'm now doing the submodule update step, which takes a long time, probably because I didn't exclude any submodules (I need to learn how to do that). When it's done, I'll try the configure command again.

                            Thanks...

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              B3lette
                              wrote on last edited by
                              #14

                              No problem, I am currently completely studying the same things and thought I could help here ...
                              See https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_submodule_source_code for infos on init-repository.
                              Personally i did --module-subset=essential,-qtdoc because that was what I needed.

                              mzimmersM 1 Reply Last reply
                              0
                              • B B3lette

                                No problem, I am currently completely studying the same things and thought I could help here ...
                                See https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_submodule_source_code for infos on init-repository.
                                Personally i did --module-subset=essential,-qtdoc because that was what I needed.

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

                                @B3lette oh, I guess that's one of the advantages of using the init-repository script -- you can include/exclude the modules as desired.

                                I'd be interested to know whether, after you've built a Qt library, whether you can go back and add modules should the need arise. Qt's build system has been known to be a little fussy in the past.

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

                                  UPDATE: after going through the procedure again, but using the init-repository script, the configure failed again, just as noted above. Then I read the fine print:

                                  ../qt5/configure

                                  and inferred from it that the configure command must be using its own relative pathnames to find files like direct.h. So I ran from my already-installed Qt instead, and the configure command succeeded. Now, we'll see how the build does.

                                  Progress, anyway...

                                  M 1 Reply Last reply
                                  0
                                  • B Offline
                                    B Offline
                                    B3lette
                                    wrote on last edited by B3lette
                                    #17

                                    Ok, happy it succeeded !

                                    Qt building is meant to be made shadow : after your checkout and repo init, you should create another directory, cd into it and call configure from it.
                                    See my first post here for a nice batch script doing it : https://forum.qt.io/topic/113984/cross-compilation-from-windows-to-aarch64

                                    mzimmersM 1 Reply Last reply
                                    1
                                    • B B3lette

                                      Ok, happy it succeeded !

                                      Qt building is meant to be made shadow : after your checkout and repo init, you should create another directory, cd into it and call configure from it.
                                      See my first post here for a nice batch script doing it : https://forum.qt.io/topic/113984/cross-compilation-from-windows-to-aarch64

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

                                      @B3lette yeah, I'm still not sure if I fully understand all that's going on, but evidently, not only do you have to build into another directory, but you have to use the configure command that exists within the already-built Qt space.

                                      Anyway, the make and make install worked, and I have my static build.

                                      Thanks to everyone who looked and helped.

                                      1 Reply Last reply
                                      0
                                      • mzimmersM mzimmers

                                        UPDATE: after going through the procedure again, but using the init-repository script, the configure failed again, just as noted above. Then I read the fine print:

                                        ../qt5/configure

                                        and inferred from it that the configure command must be using its own relative pathnames to find files like direct.h. So I ran from my already-installed Qt instead, and the configure command succeeded. Now, we'll see how the build does.

                                        Progress, anyway...

                                        M Offline
                                        M Offline
                                        Mr.Anubis
                                        wrote on last edited by
                                        #19

                                        @mzimmers said in *still* having problems building Qt (static):

                                        and inferred from it that the configure command must be using its own relative pathnames to find files like direct.h. So I ran from my already-installed Qt instead, and the configure command succeeded. Now, we'll see how the build does.

                                        exactly what steps did you take to solve this? Thanks

                                        1 Reply Last reply
                                        0
                                        • mzimmersM Offline
                                          mzimmersM Offline
                                          mzimmers
                                          wrote on last edited by
                                          #20
                                          1. Make sure that PATH includes paths to:
                                          • the toolchain (eg, C:\qt\tools\mingw1120_64\bin)
                                          • a Ninja (eg, C:\Program Files\ninja-win)
                                          1. Create and enter the directory you want for your static build.

                                          2. Use the following configure command:

                                          C:/Qt/6.8.2/Src/configure.bat -prefix c:/qt_static/6.8.2 -static -static-runtime -release -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtdatavis3d -skip qtdoc -skip qtgrpc -skip qtinsighttracker -skip qtmultimedia -skip qtgraphs -skip qtcharts -skip qtquick3d -skip qtquick3dphysics -skip qtquicktimeline -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtcoap -skip qtspeech -redo

                                          (of course, you'll want to select your own "-skip" modules)
                                          4. cmake --build . --parallel

                                          1. cmake --install .
                                          M 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 Extensions
                                          • Unsolved