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. [Solved] How to build Qt into a separate directory from the source ?
Qt 6.11 is out! See what's new in the release blog

[Solved] How to build Qt into a separate directory from the source ?

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 3 Posters 6.2k Views 1 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.
  • W Offline
    W Offline
    weiyuemin
    wrote on last edited by
    #1

    Like Qt Creator do.
    e.g. I pull the source into dir D:\Qt\qt_source, I want to build it into D:\Qt\build0421.

    I found this when I type configure -help
    @
    -prefix <dir> ...... This will install everything relative to <dir>
    (default $QT_INSTALL_PREFIX)
    @

    But it seems no use.
    I cd into D:/Qt/build0421, and configure:
    @
    ..\qt_source\configure -prefix ..\build0421 -debug-and-release <some_other_options>
    @

    Then I opened d:\build0421\qtbase\include\QtCore\qabstractanimation.h, it contains:
    @
    #include "../../../../qt_source/qtbase/src/corelib/animation/qabstractanimation.h"
    @

    It is obviously wrong to have 'qt_source' in the include path.

    I had many tries. The include path always contains 'qt_source' as long as I configure Qt outside the source directory.

    How can I build Qt into a separate directory?

    Thank you !

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Did you try to use the forward slash '/' as separator in your path?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • W Offline
        W Offline
        weiyuemin
        wrote on last edited by
        #3

        Do you mean this?
        @
        ..\qt_source\configure -prefix ../build0421/ -debug-and-release <some_other_options>
        @

        Just tried. The result d:\build0421\qtbase\include\QtCore\qabstractanimation.h still wrong. (contains ‘qt_source’)

        Because I'm actually in the directory D:/Qt/build0421, so I also tried:
        @
        ..\qt_source\configure -prefix ./ -debug-and-release <some_other_options>
        @

        Still wrong.

        Besides, ../qt_source/configure <xxxxx> do not work, because Windows command prompt doesn't recognize it.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          weiyuemin
          wrote on last edited by
          #4

          Tried absolute path so I can use forward slash:
          @
          D:\Qt\build0421>d:/Qt/qt_source/configure -prefix D:/Qt/build0421/ -debug-and-release -opensource -mp -nomake examples -nomake tests -nomake webkit -no-vcproj
          @

          Still wrong..

          Do you successfully built Qt into a separate directory on Windows?

          Thank you !

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            [quote author="weiyuemin" date="1366547924"]Tried absolute path so I can use forward slash:
            @
            D:\Qt\build0421>d:/Qt/qt_source/configure -prefix D:/Qt/build0421/ -debug-and-release -opensource -mp -nomake examples -nomake tests -nomake webkit -no-vcproj
            @

            Still wrong..

            Do you successfully built Qt into a separate directory on Windows?

            Thank you ![/quote]

            Yes, it did build Qt 4.8.4 about 2 month ago and I have used a build directory. The guide I had used and updated afterwards is this "wiki entry.":http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW

            Apparently, I have not used the prefix. At least it is not reported in configure.cache. However, following more or less the recipe of the wiki was successful.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • W Offline
              W Offline
              weiyuemin
              wrote on last edited by
              #6

              I've read that wiki entry and tried again using configure.cache and configure -redo
              Still the same results.

              My build0421\qtbase\include\QtCore\qabstractanimation.h: (a single line)
              @
              #include "../../../../qt_source/qtbase/src/corelib/animation/qabstractanimation.h"
              @

              I think it should copy the qt_source/qtbase/src/corelib/animation/qabstractanimation.h to the build directory, not use such a strange include method.

              One difference is I'm using msvc command prompt and you're using mingw.

              BTW, I'm not familiar with mingw. If I built Qt using mingw, was that means I can't use it via vsaddin and I can only use it via QtCreator?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                I have been using msvc2005 with vsaddin over a couple of years. In general the building process shouldn't make much difference. Especially the configure itself at the begin is the same for msvc and mingw. So, I do not really expect a difference there.
                Last year I decided to give Qt creator a shot. Especially you can use it also on other platforms (e.g. linux). It should save stupid fiddling around there, when bringing over my source.
                MinGW supports C++11 standard at least to some point AFAIK.
                Looking back it was not the best time to make a switch to MinGW and creator, because of the MinGW compiler support from Qt.

                To answer your question. When using MinGW compiler you should use Qt creator as IDE. I am not aware that you can even use it with msvc IDE, even so I think you can use other compilers such as from Intel.

                You did not indicate which Qt version you plan to use. With Qt 5 it is the easiest at the time being. There is the complete SDK bundled with MinGW V4.7 compiler and Qt creator.

                For the use of Qt4 with MinGW, you have o be aware that those libs are created with MinGW 4.4 which you cannot officially download from MinGW's pages. You need to dig a bit here in devnet. Not too long ago someone posted the link for MinGW V4.4 compiler. However, you need this if you are planning to use it with the currently downloadable pre-build of Qt 4.8.4.

                In general you need to have the proper matching compiler and its versions. You cannot mix. Neither within MinGW nor within different msvc versions.

                BTW which msvc do you plan to use?
                For starting the pre-builds are in my opinion the best option.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  weiyuemin
                  wrote on last edited by
                  #8

                  Thank you for writing so long :)

                  I'm using msvc2010.
                  I've tried 5.0.0, 5.0.1, 5.0.2 (pre-builds), 5.1alpha, and some versions from git before 5.1alpha.
                  I'm eager to use these new versions because of QWidget::createWindowContainer.

                  But recently I found 5.1alpha contains some critical bugs so I plan to come back to 5.0.2. I downloaded the windowContainer from https://codereview.qt-project.org/#change,44285 , patching it onto 5.0.2.

                  While compiling these version, I found building within the source directory makes the directory dirty. i.e. If I built it again, it will probably fail. Besides, I would like to copy the build result to my partners, so if I could build it in other directory, the size of the directory would be smaller.

                  I also think there wouldn't be much difference between msvc and mingw, at lease in the configure step. Anyway, it would not be a barrier for me. So I've already moved on to other problems, skipping this problem.

                  Thank you :)

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    I don't know why it isn't mentioned in docs (or maybe I haven't found it) my friend told me to do this: when you set the prefix in configure settings and then run nmake, you have to, when it's finished, run

                    bq. nmake install

                    and it will copy builded files to your directory. Ofc the qt_source folder you can remove after that.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      weiyuemin
                      wrote on last edited by
                      #10

                      Hi bee.

                      Your method do achieve what I need !

                      Thank you :)

                      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