Important: Please read the Qt Code of Conduct -

qmake using 4.8 always returns "Project ERROR: Failed to determine build specification for platform!"

  • Hi

    I've been building a project in qt5.3 for awhile, I use both qt creator and sometimes qmake on the commandline.
    I recenetly needed to build my project aginst qt 4.8, it's a plugin that needs to work with a qt 4.8 program. I set up the kit in qt creator but when i go to build it always says "Project ERROR: Failed to determine build specification for platform!",
    This is on linux. My qmake line is thus:

    qmake: qmake -r -spec linux-g++-32

    I can see the qmake.conf file.

    This also happened on a colleagues' machine. I can't find any info about this on google.

    Anyone have any ideas?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Does it happen only on that project ? By the way which version of Qt Creator are you using ?

  • Yeah I think it is just that project, maybe I should make a test one and see. Could it be something in the .user?
    The qt creator is 3.3.2. But the same thing happens running qmake on the cl.

  • So I just tried creating a default QWidgets Application project, chose only the qt4.8 kit and tried to build it, I get this:

    /usr/include/c++/4.8/utility:68:28: fatal error: bits/c++config.h: No such file or directory
    #include <bits/c++config.h>

    I thought the whole qt 4.8 I built and installed was at /usr/local/Trolltech/4.8.3. Is there another version in my ubuntu install that's confusing things?

  • Lifetime Qt Champion

    Is your Qt 4 build old ?

  • @SGaist

    Old? It's qt 4!
    Seriously though, what do you mean by old? I built the one on my machine from source the other day. The same situation on my colleague's machine, is using a build our company built a long time ago and is checked in to a repo.

  • @nickb
    SGaist refers to an old build of the library. E.g. an old build with an older compiler version and libs which have been updated afterwards.

    I am not sure if does matter as much on Linux, but windows you have to be really careful with compiler versions. Every MS compiler version has a different memory model. However, also GCC (MinGW called there) version are not always compatible.

    AFAIK Qt 4.8.0 was released around the same time or a bit later as Qt 5.0. Therefore, I believe GCC version have changed as well on linux IRC.

    Probably the best way is to recompile Qt 4.8 from recent source downloaded with your current compiler installed. This would avoid such compatibility issues.

  • Yeah, we build all of our qt libs from source. And on windows we are very particular about the MSVC versions all of our software is built against.
    This specific issue is on linux only.I have this problem with the qt4.8 that I built from source recently and with the build we get out of our repo, which I guess you could describe as old. Being that we are fairly used to developing with qt 4.8 for a long time and qt 5.X is relatively new for us, it seems this problem only occurred after using qt 5 and then trying to switch back.
    Could qt 5 have made some environmental change to our machines that prevents the older qmake from working anymore? Is there a more nuanced test I could do on qmake; ie how should it be determining the build spec for the platform?

  • Lifetime Qt Champion

    It should not (unless someone did something unusual when installing). First thing I'd check is which qmake to see which one is used. From there verify the install/mkspecs of that version.
    Then I'd verify if there's several *.pro.user in the sources and removed them (just remember that if you have special settings for your projects, move the files away so you can have a mean to get these back).

  • when i try to use the 4.8 qmake from the commandline I set the 4.8 bin folder to the beginning of my env PATH, and also set QTDIR to the 4.8 installation which is in /usr/local/Trolltech. "which qmake" does show the 4.8 one.

  • Lifetime Qt Champion

    One thing that is puzzling me is that "bits/c++config.h: No such file or directory" error is generally happening when cross-compiling...

  • So, theoretically, when using 2 different qt builds on a single machine, in order to run qmake for a given qt build, you simply need to call the appropriate qmake that is in the bin folder of the build you want?
    Like in qtcreator, in order to add another qt version, you simply need to find qmake for the version you want, and it figures out the rest?

  • Lifetime Qt Champion

    Yes, e.g. for Qt 4

    cd myProject_shadowbuild
    /usr/local/Trolltech/Qt4.8.7/bin/qmake -r /path/to/myProject
    make -j99

  • I'm almost at the point of needing to debug qmake itself! Do you know what mechanism it uses to determine the platform? Surely when I built the qt framework in the first place, at that point it would determine the platform it was on, assuming I wasn't trying to cross compile it? Maybe the "bits/c++config.h" error is a clue then, when I built it did I make it think it was building for another platform somehow?

  • Lifetime Qt Champion

    configure handles that for you unless you specify something yourself. I'm thinking of something, are you trying to build a 32bit application with a 64bit Qt ?

Log in to reply