Could not find qmake configuration file win32-msvc (Qt 5.10 src build)
I've been using Qt for about two years now, under a commercial license, and recently had to patch the 5.10 source in order to fix a missing feature (client ssl cert serving) in QtWebEngine.
I've been building it according to the configuration for the commercial build, and after some trials and tribulations I've validated that the changes were effective.
So now I'm migrating my build to these newly built libs, and I've run into a weird issue where the following command line call results in the error in the subject/topic line.
C:\QTBUILD\msvc2015\bin\qmake.exe ....\MyProject.pro -r -spec win32-msvc "CONFIG+=release"
This results in a complaint about not finding the qmake configuration file 'win32-msvc'
If I use the qmake.exe from C:\Qt\5.10\bin\qmake.exe this same command executes as expected.
There are no environment variables pointing to any Qt directories, no pathing.
The mkspecs directory in my builds match the mkspecs directories of the commercial 5.10 installation.
The sizes are very close, 611 files in my build's mkspecs, 590 in the commercial 5.10 install.
They both have the win32-msvc folder in the same relative location to their respective qmake executables.
The contents of those directories are identity (files, bytes in total size, et cetera.)
The mkspecs/common folders are identical (files, bytes, et cetera.)
When I run qmake with -d I get the same results with to a certain point:
DEBUG 1: Resetting dir to: C:\REPOSITORIES\MyProject\build\build-release-x64
DEBUG 1: Changing dir to: ....
The built 5.10 now fails with:
Could not find qmake configuration file win32-msvc.
Error processing project file: ....\MyProject.pro
The commercial build 5.10 continues on with:
DEBUG 1: visiting file C:/Qt/5.10.0/msvc2015_64/mkspecs/features/spec_pre.prf
(and then tons of other debug messages as the build keeps going until completion.)
Any ideas what this could be? Is there some sort of pathing baked into qmake.exe when it's built where you can't move it post nmake/nmake install...?
If I replace my QT build's bin directory with the one from the commercial Qt install - it completes qmake properly (I made sure to hide the mkspecs directory from the commercial build - in case it used that one.)
Should I pass the path to the spec folder as a test?
I've found that if I specify the exact path to the spec folder in my qmake call, it appears to work - which suggests that the qmake.exe I have built is using a hardcoded default path to the mkspecs directory, but the qmake.exe that comes with the 5.10 commercial build does not.
C:\QTBUILD\msvc2015\bin\qmake.exe ....\MyProject.pro -r -spec C:\QTBUILD\msvc2015_64\mkspecs\win32-msvc "CONFIG+=release"
Actually it doesn't work. All of the mkspec references appear to be relative so it breaks after a bit. (I thought it worked because I got a ton of debug output as it resolved and specified defines)
If I specify the full file path, and turn debug off, it breaks quickly with:
Project ERROR: Could not find feature shared.
Definitely something in the qmake.exe binary. If I swap the commercial qmake.exe into my built Qt hierarchy, it builds just fine - but it turns out that the commercial qmake.exe is looking into the commercial directory for its mkspecs and includes.
If I hide the directory that I copied the qmake.exe from, it breaks...? WTF?
When I run:
qmake -query "QT_INSTALL_PREFIX"
The qmake.exe which resides in C:\QTBUILD\msvc2015_x64\bin reports the directory where I copied it from:
It appears that this value 'QT_INSTALL_PREFIX' is stored in a settings file someplace (platform dependent surely) and that's the fundamental problem...
I'll try overriding that.
Okay, it turns out that you simply need to drop a qt.conf file in the bin directory that contains:
Prefix = ..
That worked for me because apparently QT_INSTALL_PREFIX is a 'built-in' (which is odd considering that you can install Qt in many locations and it apparently edits the qmake.exe post installation - much like how I edit rpath info when deploying an application.)
I tried using qmake.exe -set QT_INSTALL_PREFIX C:\path - but that didn't seem to work.