QMAKE: QMAKESPEC has not been set

ravil picture ravil · Mar 14, 2011 · Viewed 40.8k times · Source

I have recently recompiled Qt so that I can use static instead of shared libraries. But now, when I try to compile my project, I get the following error:

QMAKESPEC has not been set, so configuration cannot be deduced.

It seems like a common problem and I did do some research before posting. What's puzzling me is that I did set the QMAKESPEC env var. Here is the output of printenv QMAKESPEC

/usr/local/Trolltech/Qt-4.4.0/mkspecs/linux-g++

Also, here is the output of qmake -query QMAKESPEC

linux-g++

I have also tried playing around with the values, but it seems that qmake can't see that variable at all... QTDIR is also specified properly.

I have also tried to recompile Qt and reinstall it.

Thanks for your help.

Answer

creatron picture creatron · Nov 6, 2012

Just add this to a script before running qmake

Unix Bourne shell:

        QMAKESPEC=/usr/local/qt/mkspecs/linux-g++
        PATH=$PATH:/local/qmake/bin
        export QMAKESPEC PATH

Unix C shell:

        setenv QMAKESPEC /usr/local/qt/mkspecs/linux-g++
        setenv PATH $PATH:/local/qmake/bin

Microsoft Windows:

        set QMAKESPEC=c:\qt\mkspecs\win32-msvc
        set PATH=%PATH%;c:\qmake\bin

qmake is now installed.