How to build qt out of source
Basically, you just have to run configure.exe from your build directory. For example:
mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005
Where sources are in \qt\4.5.2-sources
, that would cause the build to go into \qt\4.5.2-build
on the current drive.
Also, you must have perl in your PATH
, ActiveState Perl is suggested.
I had not previously heard of this limitation where the build and source directories must be at the same level. If you hit this problem you could try working around it by creating a symbolic link (see mklink
command).
user152508
Updated on July 09, 2022Comments
-
user152508 almost 2 years
I was searching a lot through Qt forums and Google for the last few days, but I could not find any obvious answer to this question.
I found the
-prefix
option (not even documented on Windows) that can be supplied to configure to specify different install directory, but this is not clear separation of the sources and binaries at all, since the build is still done in the source directory and then the files needed for installation are copied to the install directoy. I tried this-prefix
option, and came to some problems. (i.e It doesn't copy the.pdb
files to the install directory.)Then I found this link about doing shadow builds but it has the big limitation that the build dir must be at the same level as the source dir.
I'm guessing you didn't try make install? So try that. It should install Qt to a separate directory away from the sources.
Are you saying that after I do configure, I should do nmake install instead just nmake? I know that nmake will process the generated makefiles from qmake and will place them in the source Qt dir, but what nmake install will exactly do i.e in which directory will install the files and how to specify the directory where the files will be installed.
Note that I already do this:
configure -prefix builddir -platform win32-msvc2005 nmake install
The effect of the above two lines was that qt was compiled in the source dir and not directly to my builddir specified with prefix. Then the compiled files were copied in my builddir. I was hoping for something that will build my Qt files directly to the build dir, cause this way I stil need 4 Gb space for my source dir during the compilation. Also the pdb files were not copied to my buildir which is another issue.
-
user152508 almost 15 yearsThis does not work. The error says that it can't include some .h file
-
user152508 almost 15 yearsthe error is at configure time and it says that it can't include some qscriptengine.h. Also in my try the build directory was not in the same level as the source directory (like in your primer above). Is this relevant?
-
user152508 almost 15 yearsHere is my folder structure : --X --qt --shadow I want to build in shadow : cd C:/X/shadow C:/X/qt/configure.exe -platform win32-msvc2005421904 I also have shadow/bin and path to perl.exe in my PATH. And Iam still getting the same error at configure time : c:\x\qt\qmake\project.h(57) : fatal error C1083: Cannot open include file: 'qscriptengine.h': No such file or directory
-
user152508 almost 15 yearsAlso note that I am getting the error when configure tries to build qmake.
-
user152508 almost 15 yearsI can't believe that there is no support from qmake (or maybe am missing something) to do this i.e to build out of source. It is such a common requirement. How suppose to store my qt library on repository now ? ha
-
rohanpm almost 15 yearsqmake (and configure, and Qt) does support this, I and many others do it all the time.
-
user152508 almost 15 yearsCan you tell me how to do it step by step please. I tried everything I can think of so far. Thank you
-
AntonyFalegk over 13 yearsActivePerl is a must for out-of-tree builds, not a suggestion. @user152508, you are gettings this error because configure script fails to copy header files. I suspect you don't have ActivePerl's
perl
in your $PATH. -
Piotr Dobrogost over 13 yearsWhich program
-prefix-install
and-prefix /path
are options for? They are not mentioned in the output ofconfigure.exe --help
-
mxcl over 13 yearsI wrote that answer 16 months ago. It may be that the Qt configure has changed.
-
asandroq about 12 yearsI have the same problem as @user152508, and I definitely have ActivePerl in my %PATH%. It just doesn't work.
-
Oliver Zendel almost 12 yearsI have the same problem too. I have ActivePerl in my path; I get numerous include files not found errors. The perl script is not properly changing the paths, but added an additional "..\..\" to every header file path in the build files.