Qt5.2.1 Build fails when using -prefix
I have a rather strange problem. I downloaded the Qt 5.2.1 source zip for windows. My goal is to build QT 5.2.1 with a PostgreSQL driver and for usage with VS2008. I already managed to compile it successfully without usage of the -prefix option in the configure call.
The configure call then looks as follows:
configure.bat -debug-and-release -opensource -shared -qt-sql-psql -opengl desktop -nomake examples -platform win32-msvc2008 -system-zlib -no-warnings-are-errors -mp -I "C:\Progra~2\PostgreSQL\9.2\include" -l "C:\Progra~2\PostgreSQL\9.2\lib\libpq" -L d:\others\qt-zlib\Release
However when I use the -prefix option to install into another directory than "qtbase" I get compile errors like the following:
d:\others\qt-everywhere-opensource-src-5.2.1\qtbase\src\network\access\qabstractnetworkcache_p.h(56) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "private/qobject_p.h": No such file or directory
Translated it means that the given header file can not be found.
The configure command I used therefore is:
configure.bat -prefix "d:\devel\qt\5.2.1" -debug-and-release -opensource -shared -qt-sql-psql -opengl desktop -nomake examples -platform win32-msvc2008 -system-zlib -no-warnings-are-errors -mp -I "C:\Progra~2\PostgreSQL\9.2\include" -l "C:\Progra~2\PostgreSQL\9.2\lib\libpq" -L d:\others\qt-zlib\Release
So it only differs in the -prefix option. The given directory is already existing, so this shouldn't cause any problems. Would be great if anyone can give me a hint on why I get this compile error.
I am not quite sure if my configure cache still contains data from a previous run. How can I ensure that this is not the case? so far I used jom distclean in the qt root directory. And as you already noticed, I am using jom for compilation.
Thanks in advance,
Extract the package anew, or run git clean to be sure there are no residues from last run.
Do not use configure.bat, just "configure". This is important.
You can also try a different approach: cd into your build directory, run configure from there and use -prefix CD (wrapped in percentage signs).
Thanks sierdzio for your help. I did as you proposed. I completely unpacked the source into a new directory. Then I called the configure command from my build directory using the CD env variable. After that I started compilation which aborted with an error in qtwinextras for which I had to apply the following fix from https://codereview.qt-project.org/#change,75844 . After that the compilation succeeded.
Is it now correct to assume, that all configure cache data is located in the build directory? So if I need to reconfigure I can do that in a new build directory or clear the current one? Is it furthermire correct that I can remove qtbase from the build dir once I have executed jom install?
[quote author="Thoran" date="1398342274"]Is it now correct to assume, that all configure cache data is located in the build directory? So if I need to reconfigure I can do that in a new build directory or clear the current one? Is it furthermire correct that I can remove qtbase from the build dir once I have executed jom install?[/quote]
The source directory remains clean, you should be able to build in other build directories without having to clean the source dir.
After installation, Qt libraries are put into <prefix dir>/qtbase/bin, so you can't delete that directory.
I know this is true for 4.7 and 4.8, I haven't looked at 5 yet, but the instructions given here http://qt-project.org/doc/qt-4.8/install-win.html about running "qmake distclean" aren't true for -prefix, it does not return the tree to the initial state. Changes to -prefix will now appear partially ignored.
The reason is the distclean does not descend into the qmake directory and the qmake.exe (in qlibraryinfo.obj) has the previous value of prefix burnt into it. A subsequent build with a new value of prefix will populate the old location with build products. I believe you end up with partially functioning installation, I found that .pro files would mostly work and others have weird errors.
Makefiles in 3rdparty don't get scrubbed either but at those will get written again with the new value of prefix when you re-run configure.exe.
I just run clean in the qmake dir to get around this:
qt-dir> nmake distclean
qt-dir> cd qmake
qt-dir> nmake distclean
qt-dir> cd ..
qt-dir> .\configure -prefix <new location> ...
you need nmake confclean to clean the qmake dir...