20

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.

ravil
  • 597
  • 2
  • 4
  • 18

5 Answers5

24

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.

Man of One Way
  • 3,904
  • 1
  • 26
  • 41
creatron
  • 241
  • 2
  • 3
  • It works but on my system the right absolute path was `/usr/share/qt4/mkspecs/linux-g++` (took me some time to figure out where that was). – MBR Sep 01 '17 at 09:22
2

if you are lazy to do extra set-env stuff, do here is a one liner:

    qmake -spec c:\qt\mkspecs\win32-msvc myproject.pro

same goes for other platforms

yerlilbilgin
  • 3,041
  • 2
  • 26
  • 21
1

I had the same problem and solved it by installing the libqt4-dev package.

user191094
  • 11
  • 1
  • 1
    Unfortunately this answer is irrelevant to the problem the OP had - dealing with custom, static build of Qt rather than the distro one. – qdot Oct 11 '12 at 10:53
1

From 4.8 on, qmake has a system of persistent information that can be defined using the -set option, and consulted using -query.

For more detail, consult the Configuring qmake's Environment for qmake 4.8, and Configuring qmake for qmake 5.0.

0

Ok, sorry, I think I know what's the problem. I have been picking up qmake from the old Qt installation that was left in /usr/bin/. I have deleted it now, and going to re-try installing Qt. Hope it will work =)

ravil
  • 597
  • 2
  • 4
  • 18